{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# United States - Crime Rates - 1960 - 2014"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Introduction:\n",
    "\n",
    "This time you will create a data \n",
    "\n",
    "Special thanks to: https://github.com/justmarkham for sharing the dataset and materials.\n",
    "\n",
    "### Step 1. Import the necessary libraries"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T09:26:56.538739Z",
     "start_time": "2024-01-13T09:26:56.316365Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 2. Import the dataset from this [address](https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/04_Apply/US_Crime_Rates/US_Crime_Rates_1960_2014.csv). "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 3. Assign it to a variable called crime."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T09:26:56.581183Z",
     "start_time": "2024-01-13T09:26:56.322591Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "    Year  Population     Total  Violent  Property  Murder  Forcible_Rape  \\\n0   1960   179323175   3384200   288460   3095700    9110          17190   \n1   1961   182992000   3488000   289390   3198600    8740          17220   \n2   1962   185771000   3752200   301510   3450700    8530          17550   \n3   1963   188483000   4109500   316970   3792500    8640          17650   \n4   1964   191141000   4564600   364220   4200400    9360          21420   \n5   1965   193526000   4739400   387390   4352000    9960          23410   \n6   1966   195576000   5223500   430180   4793300   11040          25820   \n7   1967   197457000   5903400   499930   5403500   12240          27620   \n8   1968   199399000   6720200   595010   6125200   13800          31670   \n9   1969   201385000   7410900   661870   6749000   14760          37170   \n10  1970   203235298   8098000   738820   7359200   16000          37990   \n11  1971   206212000   8588200   816500   7771700   17780          42260   \n12  1972   208230000   8248800   834900   7413900   18670          46850   \n13  1973   209851000   8718100   875910   7842200   19640          51400   \n14  1974   211392000  10253400   974720   9278700   20710          55400   \n15  1975   213124000  11292400  1039710  10252700   20510          56090   \n16  1976   214659000  11349700  1004210  10345500   18780          57080   \n17  1977   216332000  10984500  1029580   9955000   19120          63500   \n18  1978   218059000  11209000  1085550  10123400   19560          67610   \n19  1979   220099000  12249500  1208030  11041500   21460          76390   \n20  1980   225349264  13408300  1344520  12063700   23040          82990   \n21  1981   229146000  13423800  1361820  12061900   22520          82500   \n22  1982   231534000  12974400  1322390  11652000   21010          78770   \n23  1983   233981000  12108600  1258090  10850500   19310          78920   \n24  1984   236158000  11881800  1273280  10608500   18690          84230   \n25  1985   238740000  12431400  1328800  11102600   18980          88670   \n26  1986   240132887  13211869  1489169  11722700   20613          91459   \n27  1987   242282918  13508700  1483999  12024700   20096          91110   \n28  1988   245807000  13923100  1566220  12356900   20680          92490   \n29  1989   248239000  14251400  1646040  12605400   21500          94500   \n30  1990   248709873  14475600  1820130  12655500   23440         102560   \n31  1991   252177000  14872900  1911770  12961100   24700         106590   \n32  1992   255082000  14438200  1932270  12505900   23760         109060   \n33  1993   257908000  14144800  1926020  12218800   24530         106010   \n34  1994   260341000  13989500  1857670  12131900   23330         102220   \n35  1995   262755000  13862700  1798790  12063900   21610          97470   \n36  1996   265228572  13493863  1688540  11805300   19650          96250   \n37  1997   267637000  13194571  1634770  11558175   18208          96153   \n38  1998   270296000  12475634  1531044  10944590   16914          93103   \n39  1999   272690813  11634378  1426044  10208334   15522          89411   \n40  2000   281421906  11608072  1425486  10182586   15586          90178   \n41  2001   285317559  11876669  1439480  10437480   16037          90863   \n42  2002   287973924  11878954  1423677  10455277   16229          95235   \n43  2003   290690788  11826538  1383676  10442862   16528          93883   \n44  2004   293656842  11679474  1360088  10319386   16148          95089   \n45  2005   296507061  11565499  1390745  10174754   16740          94347   \n46  2006   299398484  11401511  1418043   9983568   17030          92757   \n47  2007   301621157  11251828  1408337   9843481   16929          90427   \n48  2008   304374846  11160543  1392628   9767915   16442          90479   \n49  2009   307006550  10762956  1325896   9337060   15399          89241   \n50  2010   309330219  10363873  1251248   9112625   14772          85593   \n51  2011   311587816  10258774  1206031   9052743   14661          84175   \n52  2012   313873685  10219059  1217067   9001992   14866          85141   \n53  2013   316497531   9850445  1199684   8650761   14319          82109   \n54  2014   318857056   9475816  1197987   8277829   14249          84041   \n\n    Robbery  Aggravated_assault  Burglary  Larceny_Theft  Vehicle_Theft  \n0    107840              154320    912100        1855400         328200  \n1    106670              156760    949600        1913000         336000  \n2    110860              164570    994300        2089600         366800  \n3    116470              174210   1086400        2297800         408300  \n4    130390              203050   1213200        2514400         472800  \n5    138690              215330   1282500        2572600         496900  \n6    157990              235330   1410100        2822000         561200  \n7    202910              257160   1632100        3111600         659800  \n8    262840              286700   1858900        3482700         783600  \n9    298850              311090   1981900        3888600         878500  \n10   349860              334970   2205000        4225800         928400  \n11   387700              368760   2399300        4424200         948200  \n12   376290              393090   2375500        4151200         887200  \n13   384220              420650   2565500        4347900         928800  \n14   442400              456210   3039200        5262500         977100  \n15   470500              492620   3265300        5977700        1009600  \n16   427810              500530   3108700        6270800         966000  \n17   412610              534350   3071500        5905700         977700  \n18   426930              571460   3128300        5991000        1004100  \n19   480700              629480   3327700        6601000        1112800  \n20   565840              672650   3795200        7136900        1131700  \n21   592910              663900   3779700        7194400        1087800  \n22   553130              669480   3447100        7142500        1062400  \n23   506570              653290   3129900        6712800        1007900  \n24   485010              685350   2984400        6591900        1032200  \n25   497870              723250   3073300        6926400        1102900  \n26   542775              834322   3241410        7257153        1224137  \n27   517704              855088   3236184        7499900        1288674  \n28   542970              910090   3218100        7705900        1432900  \n29   578330              951710   3168200        7872400        1564800  \n30   639270             1054860   3073900        7945700        1635900  \n31   687730             1092740   3157200        8142200        1661700  \n32   672480             1126970   2979900        7915200        1610800  \n33   659870             1135610   2834800        7820900        1563100  \n34   618950             1113180   2712800        7879800        1539300  \n35   580510             1099210   2593800        7997700        1472400  \n36   535590             1037050   2506400        7904700        1394200  \n37   498534             1023201   2460526        7743760        1354189  \n38   446625              974402   2329950        7373886        1240754  \n39   409371              911740   2100739        6955520        1152075  \n40   408016              911706   2050992        6971590        1160002  \n41   423557              909023   2116531        7092267        1228391  \n42   420806              891407   2151252        7057370        1246646  \n43   414235              859030   2154834        7026802        1261226  \n44   401470              847381   2144446        6937089        1237851  \n45   417438              862220   2155448        6783447        1235859  \n46   447403              860853   2183746        6607013        1192809  \n47   445125              855856   2176140        6568572        1095769  \n48   443574              842134   2228474        6588046         958629  \n49   408742              812514   2203313        6338095         795652  \n50   369089              781844   2168457        6204601         739565  \n51   354772              752423   2185140        6151095         716508  \n52   355051              762009   2109932        6168874         723186  \n53   345095              726575   1931835        6018632         700294  \n54   325802              741291   1729806        5858496         689527  ",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Year</th>\n      <th>Population</th>\n      <th>Total</th>\n      <th>Violent</th>\n      <th>Property</th>\n      <th>Murder</th>\n      <th>Forcible_Rape</th>\n      <th>Robbery</th>\n      <th>Aggravated_assault</th>\n      <th>Burglary</th>\n      <th>Larceny_Theft</th>\n      <th>Vehicle_Theft</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>1960</td>\n      <td>179323175</td>\n      <td>3384200</td>\n      <td>288460</td>\n      <td>3095700</td>\n      <td>9110</td>\n      <td>17190</td>\n      <td>107840</td>\n      <td>154320</td>\n      <td>912100</td>\n      <td>1855400</td>\n      <td>328200</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1961</td>\n      <td>182992000</td>\n      <td>3488000</td>\n      <td>289390</td>\n      <td>3198600</td>\n      <td>8740</td>\n      <td>17220</td>\n      <td>106670</td>\n      <td>156760</td>\n      <td>949600</td>\n      <td>1913000</td>\n      <td>336000</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>1962</td>\n      <td>185771000</td>\n      <td>3752200</td>\n      <td>301510</td>\n      <td>3450700</td>\n      <td>8530</td>\n      <td>17550</td>\n      <td>110860</td>\n      <td>164570</td>\n      <td>994300</td>\n      <td>2089600</td>\n      <td>366800</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>1963</td>\n      <td>188483000</td>\n      <td>4109500</td>\n      <td>316970</td>\n      <td>3792500</td>\n      <td>8640</td>\n      <td>17650</td>\n      <td>116470</td>\n      <td>174210</td>\n      <td>1086400</td>\n      <td>2297800</td>\n      <td>408300</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>1964</td>\n      <td>191141000</td>\n      <td>4564600</td>\n      <td>364220</td>\n      <td>4200400</td>\n      <td>9360</td>\n      <td>21420</td>\n      <td>130390</td>\n      <td>203050</td>\n      <td>1213200</td>\n      <td>2514400</td>\n      <td>472800</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>1965</td>\n      <td>193526000</td>\n      <td>4739400</td>\n      <td>387390</td>\n      <td>4352000</td>\n      <td>9960</td>\n      <td>23410</td>\n      <td>138690</td>\n      <td>215330</td>\n      <td>1282500</td>\n      <td>2572600</td>\n      <td>496900</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>1966</td>\n      <td>195576000</td>\n      <td>5223500</td>\n      <td>430180</td>\n      <td>4793300</td>\n      <td>11040</td>\n      <td>25820</td>\n      <td>157990</td>\n      <td>235330</td>\n      <td>1410100</td>\n      <td>2822000</td>\n      <td>561200</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>1967</td>\n      <td>197457000</td>\n      <td>5903400</td>\n      <td>499930</td>\n      <td>5403500</td>\n      <td>12240</td>\n      <td>27620</td>\n      <td>202910</td>\n      <td>257160</td>\n      <td>1632100</td>\n      <td>3111600</td>\n      <td>659800</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>1968</td>\n      <td>199399000</td>\n      <td>6720200</td>\n      <td>595010</td>\n      <td>6125200</td>\n      <td>13800</td>\n      <td>31670</td>\n      <td>262840</td>\n      <td>286700</td>\n      <td>1858900</td>\n      <td>3482700</td>\n      <td>783600</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>1969</td>\n      <td>201385000</td>\n      <td>7410900</td>\n      <td>661870</td>\n      <td>6749000</td>\n      <td>14760</td>\n      <td>37170</td>\n      <td>298850</td>\n      <td>311090</td>\n      <td>1981900</td>\n      <td>3888600</td>\n      <td>878500</td>\n    </tr>\n    <tr>\n      <th>10</th>\n      <td>1970</td>\n      <td>203235298</td>\n      <td>8098000</td>\n      <td>738820</td>\n      <td>7359200</td>\n      <td>16000</td>\n      <td>37990</td>\n      <td>349860</td>\n      <td>334970</td>\n      <td>2205000</td>\n      <td>4225800</td>\n      <td>928400</td>\n    </tr>\n    <tr>\n      <th>11</th>\n      <td>1971</td>\n      <td>206212000</td>\n      <td>8588200</td>\n      <td>816500</td>\n      <td>7771700</td>\n      <td>17780</td>\n      <td>42260</td>\n      <td>387700</td>\n      <td>368760</td>\n      <td>2399300</td>\n      <td>4424200</td>\n      <td>948200</td>\n    </tr>\n    <tr>\n      <th>12</th>\n      <td>1972</td>\n      <td>208230000</td>\n      <td>8248800</td>\n      <td>834900</td>\n      <td>7413900</td>\n      <td>18670</td>\n      <td>46850</td>\n      <td>376290</td>\n      <td>393090</td>\n      <td>2375500</td>\n      <td>4151200</td>\n      <td>887200</td>\n    </tr>\n    <tr>\n      <th>13</th>\n      <td>1973</td>\n      <td>209851000</td>\n      <td>8718100</td>\n      <td>875910</td>\n      <td>7842200</td>\n      <td>19640</td>\n      <td>51400</td>\n      <td>384220</td>\n      <td>420650</td>\n      <td>2565500</td>\n      <td>4347900</td>\n      <td>928800</td>\n    </tr>\n    <tr>\n      <th>14</th>\n      <td>1974</td>\n      <td>211392000</td>\n      <td>10253400</td>\n      <td>974720</td>\n      <td>9278700</td>\n      <td>20710</td>\n      <td>55400</td>\n      <td>442400</td>\n      <td>456210</td>\n      <td>3039200</td>\n      <td>5262500</td>\n      <td>977100</td>\n    </tr>\n    <tr>\n      <th>15</th>\n      <td>1975</td>\n      <td>213124000</td>\n      <td>11292400</td>\n      <td>1039710</td>\n      <td>10252700</td>\n      <td>20510</td>\n      <td>56090</td>\n      <td>470500</td>\n      <td>492620</td>\n      <td>3265300</td>\n      <td>5977700</td>\n      <td>1009600</td>\n    </tr>\n    <tr>\n      <th>16</th>\n      <td>1976</td>\n      <td>214659000</td>\n      <td>11349700</td>\n      <td>1004210</td>\n      <td>10345500</td>\n      <td>18780</td>\n      <td>57080</td>\n      <td>427810</td>\n      <td>500530</td>\n      <td>3108700</td>\n      <td>6270800</td>\n      <td>966000</td>\n    </tr>\n    <tr>\n      <th>17</th>\n      <td>1977</td>\n      <td>216332000</td>\n      <td>10984500</td>\n      <td>1029580</td>\n      <td>9955000</td>\n      <td>19120</td>\n      <td>63500</td>\n      <td>412610</td>\n      <td>534350</td>\n      <td>3071500</td>\n      <td>5905700</td>\n      <td>977700</td>\n    </tr>\n    <tr>\n      <th>18</th>\n      <td>1978</td>\n      <td>218059000</td>\n      <td>11209000</td>\n      <td>1085550</td>\n      <td>10123400</td>\n      <td>19560</td>\n      <td>67610</td>\n      <td>426930</td>\n      <td>571460</td>\n      <td>3128300</td>\n      <td>5991000</td>\n      <td>1004100</td>\n    </tr>\n    <tr>\n      <th>19</th>\n      <td>1979</td>\n      <td>220099000</td>\n      <td>12249500</td>\n      <td>1208030</td>\n      <td>11041500</td>\n      <td>21460</td>\n      <td>76390</td>\n      <td>480700</td>\n      <td>629480</td>\n      <td>3327700</td>\n      <td>6601000</td>\n      <td>1112800</td>\n    </tr>\n    <tr>\n      <th>20</th>\n      <td>1980</td>\n      <td>225349264</td>\n      <td>13408300</td>\n      <td>1344520</td>\n      <td>12063700</td>\n      <td>23040</td>\n      <td>82990</td>\n      <td>565840</td>\n      <td>672650</td>\n      <td>3795200</td>\n      <td>7136900</td>\n      <td>1131700</td>\n    </tr>\n    <tr>\n      <th>21</th>\n      <td>1981</td>\n      <td>229146000</td>\n      <td>13423800</td>\n      <td>1361820</td>\n      <td>12061900</td>\n      <td>22520</td>\n      <td>82500</td>\n      <td>592910</td>\n      <td>663900</td>\n      <td>3779700</td>\n      <td>7194400</td>\n      <td>1087800</td>\n    </tr>\n    <tr>\n      <th>22</th>\n      <td>1982</td>\n      <td>231534000</td>\n      <td>12974400</td>\n      <td>1322390</td>\n      <td>11652000</td>\n      <td>21010</td>\n      <td>78770</td>\n      <td>553130</td>\n      <td>669480</td>\n      <td>3447100</td>\n      <td>7142500</td>\n      <td>1062400</td>\n    </tr>\n    <tr>\n      <th>23</th>\n      <td>1983</td>\n      <td>233981000</td>\n      <td>12108600</td>\n      <td>1258090</td>\n      <td>10850500</td>\n      <td>19310</td>\n      <td>78920</td>\n      <td>506570</td>\n      <td>653290</td>\n      <td>3129900</td>\n      <td>6712800</td>\n      <td>1007900</td>\n    </tr>\n    <tr>\n      <th>24</th>\n      <td>1984</td>\n      <td>236158000</td>\n      <td>11881800</td>\n      <td>1273280</td>\n      <td>10608500</td>\n      <td>18690</td>\n      <td>84230</td>\n      <td>485010</td>\n      <td>685350</td>\n      <td>2984400</td>\n      <td>6591900</td>\n      <td>1032200</td>\n    </tr>\n    <tr>\n      <th>25</th>\n      <td>1985</td>\n      <td>238740000</td>\n      <td>12431400</td>\n      <td>1328800</td>\n      <td>11102600</td>\n      <td>18980</td>\n      <td>88670</td>\n      <td>497870</td>\n      <td>723250</td>\n      <td>3073300</td>\n      <td>6926400</td>\n      <td>1102900</td>\n    </tr>\n    <tr>\n      <th>26</th>\n      <td>1986</td>\n      <td>240132887</td>\n      <td>13211869</td>\n      <td>1489169</td>\n      <td>11722700</td>\n      <td>20613</td>\n      <td>91459</td>\n      <td>542775</td>\n      <td>834322</td>\n      <td>3241410</td>\n      <td>7257153</td>\n      <td>1224137</td>\n    </tr>\n    <tr>\n      <th>27</th>\n      <td>1987</td>\n      <td>242282918</td>\n      <td>13508700</td>\n      <td>1483999</td>\n      <td>12024700</td>\n      <td>20096</td>\n      <td>91110</td>\n      <td>517704</td>\n      <td>855088</td>\n      <td>3236184</td>\n      <td>7499900</td>\n      <td>1288674</td>\n    </tr>\n    <tr>\n      <th>28</th>\n      <td>1988</td>\n      <td>245807000</td>\n      <td>13923100</td>\n      <td>1566220</td>\n      <td>12356900</td>\n      <td>20680</td>\n      <td>92490</td>\n      <td>542970</td>\n      <td>910090</td>\n      <td>3218100</td>\n      <td>7705900</td>\n      <td>1432900</td>\n    </tr>\n    <tr>\n      <th>29</th>\n      <td>1989</td>\n      <td>248239000</td>\n      <td>14251400</td>\n      <td>1646040</td>\n      <td>12605400</td>\n      <td>21500</td>\n      <td>94500</td>\n      <td>578330</td>\n      <td>951710</td>\n      <td>3168200</td>\n      <td>7872400</td>\n      <td>1564800</td>\n    </tr>\n    <tr>\n      <th>30</th>\n      <td>1990</td>\n      <td>248709873</td>\n      <td>14475600</td>\n      <td>1820130</td>\n      <td>12655500</td>\n      <td>23440</td>\n      <td>102560</td>\n      <td>639270</td>\n      <td>1054860</td>\n      <td>3073900</td>\n      <td>7945700</td>\n      <td>1635900</td>\n    </tr>\n    <tr>\n      <th>31</th>\n      <td>1991</td>\n      <td>252177000</td>\n      <td>14872900</td>\n      <td>1911770</td>\n      <td>12961100</td>\n      <td>24700</td>\n      <td>106590</td>\n      <td>687730</td>\n      <td>1092740</td>\n      <td>3157200</td>\n      <td>8142200</td>\n      <td>1661700</td>\n    </tr>\n    <tr>\n      <th>32</th>\n      <td>1992</td>\n      <td>255082000</td>\n      <td>14438200</td>\n      <td>1932270</td>\n      <td>12505900</td>\n      <td>23760</td>\n      <td>109060</td>\n      <td>672480</td>\n      <td>1126970</td>\n      <td>2979900</td>\n      <td>7915200</td>\n      <td>1610800</td>\n    </tr>\n    <tr>\n      <th>33</th>\n      <td>1993</td>\n      <td>257908000</td>\n      <td>14144800</td>\n      <td>1926020</td>\n      <td>12218800</td>\n      <td>24530</td>\n      <td>106010</td>\n      <td>659870</td>\n      <td>1135610</td>\n      <td>2834800</td>\n      <td>7820900</td>\n      <td>1563100</td>\n    </tr>\n    <tr>\n      <th>34</th>\n      <td>1994</td>\n      <td>260341000</td>\n      <td>13989500</td>\n      <td>1857670</td>\n      <td>12131900</td>\n      <td>23330</td>\n      <td>102220</td>\n      <td>618950</td>\n      <td>1113180</td>\n      <td>2712800</td>\n      <td>7879800</td>\n      <td>1539300</td>\n    </tr>\n    <tr>\n      <th>35</th>\n      <td>1995</td>\n      <td>262755000</td>\n      <td>13862700</td>\n      <td>1798790</td>\n      <td>12063900</td>\n      <td>21610</td>\n      <td>97470</td>\n      <td>580510</td>\n      <td>1099210</td>\n      <td>2593800</td>\n      <td>7997700</td>\n      <td>1472400</td>\n    </tr>\n    <tr>\n      <th>36</th>\n      <td>1996</td>\n      <td>265228572</td>\n      <td>13493863</td>\n      <td>1688540</td>\n      <td>11805300</td>\n      <td>19650</td>\n      <td>96250</td>\n      <td>535590</td>\n      <td>1037050</td>\n      <td>2506400</td>\n      <td>7904700</td>\n      <td>1394200</td>\n    </tr>\n    <tr>\n      <th>37</th>\n      <td>1997</td>\n      <td>267637000</td>\n      <td>13194571</td>\n      <td>1634770</td>\n      <td>11558175</td>\n      <td>18208</td>\n      <td>96153</td>\n      <td>498534</td>\n      <td>1023201</td>\n      <td>2460526</td>\n      <td>7743760</td>\n      <td>1354189</td>\n    </tr>\n    <tr>\n      <th>38</th>\n      <td>1998</td>\n      <td>270296000</td>\n      <td>12475634</td>\n      <td>1531044</td>\n      <td>10944590</td>\n      <td>16914</td>\n      <td>93103</td>\n      <td>446625</td>\n      <td>974402</td>\n      <td>2329950</td>\n      <td>7373886</td>\n      <td>1240754</td>\n    </tr>\n    <tr>\n      <th>39</th>\n      <td>1999</td>\n      <td>272690813</td>\n      <td>11634378</td>\n      <td>1426044</td>\n      <td>10208334</td>\n      <td>15522</td>\n      <td>89411</td>\n      <td>409371</td>\n      <td>911740</td>\n      <td>2100739</td>\n      <td>6955520</td>\n      <td>1152075</td>\n    </tr>\n    <tr>\n      <th>40</th>\n      <td>2000</td>\n      <td>281421906</td>\n      <td>11608072</td>\n      <td>1425486</td>\n      <td>10182586</td>\n      <td>15586</td>\n      <td>90178</td>\n      <td>408016</td>\n      <td>911706</td>\n      <td>2050992</td>\n      <td>6971590</td>\n      <td>1160002</td>\n    </tr>\n    <tr>\n      <th>41</th>\n      <td>2001</td>\n      <td>285317559</td>\n      <td>11876669</td>\n      <td>1439480</td>\n      <td>10437480</td>\n      <td>16037</td>\n      <td>90863</td>\n      <td>423557</td>\n      <td>909023</td>\n      <td>2116531</td>\n      <td>7092267</td>\n      <td>1228391</td>\n    </tr>\n    <tr>\n      <th>42</th>\n      <td>2002</td>\n      <td>287973924</td>\n      <td>11878954</td>\n      <td>1423677</td>\n      <td>10455277</td>\n      <td>16229</td>\n      <td>95235</td>\n      <td>420806</td>\n      <td>891407</td>\n      <td>2151252</td>\n      <td>7057370</td>\n      <td>1246646</td>\n    </tr>\n    <tr>\n      <th>43</th>\n      <td>2003</td>\n      <td>290690788</td>\n      <td>11826538</td>\n      <td>1383676</td>\n      <td>10442862</td>\n      <td>16528</td>\n      <td>93883</td>\n      <td>414235</td>\n      <td>859030</td>\n      <td>2154834</td>\n      <td>7026802</td>\n      <td>1261226</td>\n    </tr>\n    <tr>\n      <th>44</th>\n      <td>2004</td>\n      <td>293656842</td>\n      <td>11679474</td>\n      <td>1360088</td>\n      <td>10319386</td>\n      <td>16148</td>\n      <td>95089</td>\n      <td>401470</td>\n      <td>847381</td>\n      <td>2144446</td>\n      <td>6937089</td>\n      <td>1237851</td>\n    </tr>\n    <tr>\n      <th>45</th>\n      <td>2005</td>\n      <td>296507061</td>\n      <td>11565499</td>\n      <td>1390745</td>\n      <td>10174754</td>\n      <td>16740</td>\n      <td>94347</td>\n      <td>417438</td>\n      <td>862220</td>\n      <td>2155448</td>\n      <td>6783447</td>\n      <td>1235859</td>\n    </tr>\n    <tr>\n      <th>46</th>\n      <td>2006</td>\n      <td>299398484</td>\n      <td>11401511</td>\n      <td>1418043</td>\n      <td>9983568</td>\n      <td>17030</td>\n      <td>92757</td>\n      <td>447403</td>\n      <td>860853</td>\n      <td>2183746</td>\n      <td>6607013</td>\n      <td>1192809</td>\n    </tr>\n    <tr>\n      <th>47</th>\n      <td>2007</td>\n      <td>301621157</td>\n      <td>11251828</td>\n      <td>1408337</td>\n      <td>9843481</td>\n      <td>16929</td>\n      <td>90427</td>\n      <td>445125</td>\n      <td>855856</td>\n      <td>2176140</td>\n      <td>6568572</td>\n      <td>1095769</td>\n    </tr>\n    <tr>\n      <th>48</th>\n      <td>2008</td>\n      <td>304374846</td>\n      <td>11160543</td>\n      <td>1392628</td>\n      <td>9767915</td>\n      <td>16442</td>\n      <td>90479</td>\n      <td>443574</td>\n      <td>842134</td>\n      <td>2228474</td>\n      <td>6588046</td>\n      <td>958629</td>\n    </tr>\n    <tr>\n      <th>49</th>\n      <td>2009</td>\n      <td>307006550</td>\n      <td>10762956</td>\n      <td>1325896</td>\n      <td>9337060</td>\n      <td>15399</td>\n      <td>89241</td>\n      <td>408742</td>\n      <td>812514</td>\n      <td>2203313</td>\n      <td>6338095</td>\n      <td>795652</td>\n    </tr>\n    <tr>\n      <th>50</th>\n      <td>2010</td>\n      <td>309330219</td>\n      <td>10363873</td>\n      <td>1251248</td>\n      <td>9112625</td>\n      <td>14772</td>\n      <td>85593</td>\n      <td>369089</td>\n      <td>781844</td>\n      <td>2168457</td>\n      <td>6204601</td>\n      <td>739565</td>\n    </tr>\n    <tr>\n      <th>51</th>\n      <td>2011</td>\n      <td>311587816</td>\n      <td>10258774</td>\n      <td>1206031</td>\n      <td>9052743</td>\n      <td>14661</td>\n      <td>84175</td>\n      <td>354772</td>\n      <td>752423</td>\n      <td>2185140</td>\n      <td>6151095</td>\n      <td>716508</td>\n    </tr>\n    <tr>\n      <th>52</th>\n      <td>2012</td>\n      <td>313873685</td>\n      <td>10219059</td>\n      <td>1217067</td>\n      <td>9001992</td>\n      <td>14866</td>\n      <td>85141</td>\n      <td>355051</td>\n      <td>762009</td>\n      <td>2109932</td>\n      <td>6168874</td>\n      <td>723186</td>\n    </tr>\n    <tr>\n      <th>53</th>\n      <td>2013</td>\n      <td>316497531</td>\n      <td>9850445</td>\n      <td>1199684</td>\n      <td>8650761</td>\n      <td>14319</td>\n      <td>82109</td>\n      <td>345095</td>\n      <td>726575</td>\n      <td>1931835</td>\n      <td>6018632</td>\n      <td>700294</td>\n    </tr>\n    <tr>\n      <th>54</th>\n      <td>2014</td>\n      <td>318857056</td>\n      <td>9475816</td>\n      <td>1197987</td>\n      <td>8277829</td>\n      <td>14249</td>\n      <td>84041</td>\n      <td>325802</td>\n      <td>741291</td>\n      <td>1729806</td>\n      <td>5858496</td>\n      <td>689527</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 130,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "crime = pd.read_csv(\"https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/04_Apply/US_Crime_Rates/US_Crime_Rates_1960_2014.csv\")\n",
    "crime"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 4. What is the type of the columns?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T09:26:56.589602Z",
     "start_time": "2024-01-13T09:26:56.506501Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "Year                  int64\nPopulation            int64\nTotal                 int64\nViolent               int64\nProperty              int64\nMurder                int64\nForcible_Rape         int64\nRobbery               int64\nAggravated_assault    int64\nBurglary              int64\nLarceny_Theft         int64\nVehicle_Theft         int64\ndtype: object"
     },
     "execution_count": 131,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "crime.dtypes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Have you noticed that the type of Year is int64. But pandas has a different type to work with Time Series. Let's see it now.\n",
    "\n",
    "### Step 5. Convert the type of the column Year to datetime64"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T09:26:56.614894Z",
     "start_time": "2024-01-13T09:26:56.516271Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "         Year  Population     Total  Violent  Property  Murder  Forcible_Rape  \\\n0  1960-01-01   179323175   3384200   288460   3095700    9110          17190   \n1  1961-01-01   182992000   3488000   289390   3198600    8740          17220   \n2  1962-01-01   185771000   3752200   301510   3450700    8530          17550   \n3  1963-01-01   188483000   4109500   316970   3792500    8640          17650   \n4  1964-01-01   191141000   4564600   364220   4200400    9360          21420   \n5  1965-01-01   193526000   4739400   387390   4352000    9960          23410   \n6  1966-01-01   195576000   5223500   430180   4793300   11040          25820   \n7  1967-01-01   197457000   5903400   499930   5403500   12240          27620   \n8  1968-01-01   199399000   6720200   595010   6125200   13800          31670   \n9  1969-01-01   201385000   7410900   661870   6749000   14760          37170   \n10 1970-01-01   203235298   8098000   738820   7359200   16000          37990   \n11 1971-01-01   206212000   8588200   816500   7771700   17780          42260   \n12 1972-01-01   208230000   8248800   834900   7413900   18670          46850   \n13 1973-01-01   209851000   8718100   875910   7842200   19640          51400   \n14 1974-01-01   211392000  10253400   974720   9278700   20710          55400   \n15 1975-01-01   213124000  11292400  1039710  10252700   20510          56090   \n16 1976-01-01   214659000  11349700  1004210  10345500   18780          57080   \n17 1977-01-01   216332000  10984500  1029580   9955000   19120          63500   \n18 1978-01-01   218059000  11209000  1085550  10123400   19560          67610   \n19 1979-01-01   220099000  12249500  1208030  11041500   21460          76390   \n20 1980-01-01   225349264  13408300  1344520  12063700   23040          82990   \n21 1981-01-01   229146000  13423800  1361820  12061900   22520          82500   \n22 1982-01-01   231534000  12974400  1322390  11652000   21010          78770   \n23 1983-01-01   233981000  12108600  1258090  10850500   19310          78920   \n24 1984-01-01   236158000  11881800  1273280  10608500   18690          84230   \n25 1985-01-01   238740000  12431400  1328800  11102600   18980          88670   \n26 1986-01-01   240132887  13211869  1489169  11722700   20613          91459   \n27 1987-01-01   242282918  13508700  1483999  12024700   20096          91110   \n28 1988-01-01   245807000  13923100  1566220  12356900   20680          92490   \n29 1989-01-01   248239000  14251400  1646040  12605400   21500          94500   \n30 1990-01-01   248709873  14475600  1820130  12655500   23440         102560   \n31 1991-01-01   252177000  14872900  1911770  12961100   24700         106590   \n32 1992-01-01   255082000  14438200  1932270  12505900   23760         109060   \n33 1993-01-01   257908000  14144800  1926020  12218800   24530         106010   \n34 1994-01-01   260341000  13989500  1857670  12131900   23330         102220   \n35 1995-01-01   262755000  13862700  1798790  12063900   21610          97470   \n36 1996-01-01   265228572  13493863  1688540  11805300   19650          96250   \n37 1997-01-01   267637000  13194571  1634770  11558175   18208          96153   \n38 1998-01-01   270296000  12475634  1531044  10944590   16914          93103   \n39 1999-01-01   272690813  11634378  1426044  10208334   15522          89411   \n40 2000-01-01   281421906  11608072  1425486  10182586   15586          90178   \n41 2001-01-01   285317559  11876669  1439480  10437480   16037          90863   \n42 2002-01-01   287973924  11878954  1423677  10455277   16229          95235   \n43 2003-01-01   290690788  11826538  1383676  10442862   16528          93883   \n44 2004-01-01   293656842  11679474  1360088  10319386   16148          95089   \n45 2005-01-01   296507061  11565499  1390745  10174754   16740          94347   \n46 2006-01-01   299398484  11401511  1418043   9983568   17030          92757   \n47 2007-01-01   301621157  11251828  1408337   9843481   16929          90427   \n48 2008-01-01   304374846  11160543  1392628   9767915   16442          90479   \n49 2009-01-01   307006550  10762956  1325896   9337060   15399          89241   \n50 2010-01-01   309330219  10363873  1251248   9112625   14772          85593   \n51 2011-01-01   311587816  10258774  1206031   9052743   14661          84175   \n52 2012-01-01   313873685  10219059  1217067   9001992   14866          85141   \n53 2013-01-01   316497531   9850445  1199684   8650761   14319          82109   \n54 2014-01-01   318857056   9475816  1197987   8277829   14249          84041   \n\n    Robbery  Aggravated_assault  Burglary  Larceny_Theft  Vehicle_Theft  \n0    107840              154320    912100        1855400         328200  \n1    106670              156760    949600        1913000         336000  \n2    110860              164570    994300        2089600         366800  \n3    116470              174210   1086400        2297800         408300  \n4    130390              203050   1213200        2514400         472800  \n5    138690              215330   1282500        2572600         496900  \n6    157990              235330   1410100        2822000         561200  \n7    202910              257160   1632100        3111600         659800  \n8    262840              286700   1858900        3482700         783600  \n9    298850              311090   1981900        3888600         878500  \n10   349860              334970   2205000        4225800         928400  \n11   387700              368760   2399300        4424200         948200  \n12   376290              393090   2375500        4151200         887200  \n13   384220              420650   2565500        4347900         928800  \n14   442400              456210   3039200        5262500         977100  \n15   470500              492620   3265300        5977700        1009600  \n16   427810              500530   3108700        6270800         966000  \n17   412610              534350   3071500        5905700         977700  \n18   426930              571460   3128300        5991000        1004100  \n19   480700              629480   3327700        6601000        1112800  \n20   565840              672650   3795200        7136900        1131700  \n21   592910              663900   3779700        7194400        1087800  \n22   553130              669480   3447100        7142500        1062400  \n23   506570              653290   3129900        6712800        1007900  \n24   485010              685350   2984400        6591900        1032200  \n25   497870              723250   3073300        6926400        1102900  \n26   542775              834322   3241410        7257153        1224137  \n27   517704              855088   3236184        7499900        1288674  \n28   542970              910090   3218100        7705900        1432900  \n29   578330              951710   3168200        7872400        1564800  \n30   639270             1054860   3073900        7945700        1635900  \n31   687730             1092740   3157200        8142200        1661700  \n32   672480             1126970   2979900        7915200        1610800  \n33   659870             1135610   2834800        7820900        1563100  \n34   618950             1113180   2712800        7879800        1539300  \n35   580510             1099210   2593800        7997700        1472400  \n36   535590             1037050   2506400        7904700        1394200  \n37   498534             1023201   2460526        7743760        1354189  \n38   446625              974402   2329950        7373886        1240754  \n39   409371              911740   2100739        6955520        1152075  \n40   408016              911706   2050992        6971590        1160002  \n41   423557              909023   2116531        7092267        1228391  \n42   420806              891407   2151252        7057370        1246646  \n43   414235              859030   2154834        7026802        1261226  \n44   401470              847381   2144446        6937089        1237851  \n45   417438              862220   2155448        6783447        1235859  \n46   447403              860853   2183746        6607013        1192809  \n47   445125              855856   2176140        6568572        1095769  \n48   443574              842134   2228474        6588046         958629  \n49   408742              812514   2203313        6338095         795652  \n50   369089              781844   2168457        6204601         739565  \n51   354772              752423   2185140        6151095         716508  \n52   355051              762009   2109932        6168874         723186  \n53   345095              726575   1931835        6018632         700294  \n54   325802              741291   1729806        5858496         689527  ",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Year</th>\n      <th>Population</th>\n      <th>Total</th>\n      <th>Violent</th>\n      <th>Property</th>\n      <th>Murder</th>\n      <th>Forcible_Rape</th>\n      <th>Robbery</th>\n      <th>Aggravated_assault</th>\n      <th>Burglary</th>\n      <th>Larceny_Theft</th>\n      <th>Vehicle_Theft</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>1960-01-01</td>\n      <td>179323175</td>\n      <td>3384200</td>\n      <td>288460</td>\n      <td>3095700</td>\n      <td>9110</td>\n      <td>17190</td>\n      <td>107840</td>\n      <td>154320</td>\n      <td>912100</td>\n      <td>1855400</td>\n      <td>328200</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>1961-01-01</td>\n      <td>182992000</td>\n      <td>3488000</td>\n      <td>289390</td>\n      <td>3198600</td>\n      <td>8740</td>\n      <td>17220</td>\n      <td>106670</td>\n      <td>156760</td>\n      <td>949600</td>\n      <td>1913000</td>\n      <td>336000</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>1962-01-01</td>\n      <td>185771000</td>\n      <td>3752200</td>\n      <td>301510</td>\n      <td>3450700</td>\n      <td>8530</td>\n      <td>17550</td>\n      <td>110860</td>\n      <td>164570</td>\n      <td>994300</td>\n      <td>2089600</td>\n      <td>366800</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>1963-01-01</td>\n      <td>188483000</td>\n      <td>4109500</td>\n      <td>316970</td>\n      <td>3792500</td>\n      <td>8640</td>\n      <td>17650</td>\n      <td>116470</td>\n      <td>174210</td>\n      <td>1086400</td>\n      <td>2297800</td>\n      <td>408300</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>1964-01-01</td>\n      <td>191141000</td>\n      <td>4564600</td>\n      <td>364220</td>\n      <td>4200400</td>\n      <td>9360</td>\n      <td>21420</td>\n      <td>130390</td>\n      <td>203050</td>\n      <td>1213200</td>\n      <td>2514400</td>\n      <td>472800</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>1965-01-01</td>\n      <td>193526000</td>\n      <td>4739400</td>\n      <td>387390</td>\n      <td>4352000</td>\n      <td>9960</td>\n      <td>23410</td>\n      <td>138690</td>\n      <td>215330</td>\n      <td>1282500</td>\n      <td>2572600</td>\n      <td>496900</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>1966-01-01</td>\n      <td>195576000</td>\n      <td>5223500</td>\n      <td>430180</td>\n      <td>4793300</td>\n      <td>11040</td>\n      <td>25820</td>\n      <td>157990</td>\n      <td>235330</td>\n      <td>1410100</td>\n      <td>2822000</td>\n      <td>561200</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>1967-01-01</td>\n      <td>197457000</td>\n      <td>5903400</td>\n      <td>499930</td>\n      <td>5403500</td>\n      <td>12240</td>\n      <td>27620</td>\n      <td>202910</td>\n      <td>257160</td>\n      <td>1632100</td>\n      <td>3111600</td>\n      <td>659800</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>1968-01-01</td>\n      <td>199399000</td>\n      <td>6720200</td>\n      <td>595010</td>\n      <td>6125200</td>\n      <td>13800</td>\n      <td>31670</td>\n      <td>262840</td>\n      <td>286700</td>\n      <td>1858900</td>\n      <td>3482700</td>\n      <td>783600</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>1969-01-01</td>\n      <td>201385000</td>\n      <td>7410900</td>\n      <td>661870</td>\n      <td>6749000</td>\n      <td>14760</td>\n      <td>37170</td>\n      <td>298850</td>\n      <td>311090</td>\n      <td>1981900</td>\n      <td>3888600</td>\n      <td>878500</td>\n    </tr>\n    <tr>\n      <th>10</th>\n      <td>1970-01-01</td>\n      <td>203235298</td>\n      <td>8098000</td>\n      <td>738820</td>\n      <td>7359200</td>\n      <td>16000</td>\n      <td>37990</td>\n      <td>349860</td>\n      <td>334970</td>\n      <td>2205000</td>\n      <td>4225800</td>\n      <td>928400</td>\n    </tr>\n    <tr>\n      <th>11</th>\n      <td>1971-01-01</td>\n      <td>206212000</td>\n      <td>8588200</td>\n      <td>816500</td>\n      <td>7771700</td>\n      <td>17780</td>\n      <td>42260</td>\n      <td>387700</td>\n      <td>368760</td>\n      <td>2399300</td>\n      <td>4424200</td>\n      <td>948200</td>\n    </tr>\n    <tr>\n      <th>12</th>\n      <td>1972-01-01</td>\n      <td>208230000</td>\n      <td>8248800</td>\n      <td>834900</td>\n      <td>7413900</td>\n      <td>18670</td>\n      <td>46850</td>\n      <td>376290</td>\n      <td>393090</td>\n      <td>2375500</td>\n      <td>4151200</td>\n      <td>887200</td>\n    </tr>\n    <tr>\n      <th>13</th>\n      <td>1973-01-01</td>\n      <td>209851000</td>\n      <td>8718100</td>\n      <td>875910</td>\n      <td>7842200</td>\n      <td>19640</td>\n      <td>51400</td>\n      <td>384220</td>\n      <td>420650</td>\n      <td>2565500</td>\n      <td>4347900</td>\n      <td>928800</td>\n    </tr>\n    <tr>\n      <th>14</th>\n      <td>1974-01-01</td>\n      <td>211392000</td>\n      <td>10253400</td>\n      <td>974720</td>\n      <td>9278700</td>\n      <td>20710</td>\n      <td>55400</td>\n      <td>442400</td>\n      <td>456210</td>\n      <td>3039200</td>\n      <td>5262500</td>\n      <td>977100</td>\n    </tr>\n    <tr>\n      <th>15</th>\n      <td>1975-01-01</td>\n      <td>213124000</td>\n      <td>11292400</td>\n      <td>1039710</td>\n      <td>10252700</td>\n      <td>20510</td>\n      <td>56090</td>\n      <td>470500</td>\n      <td>492620</td>\n      <td>3265300</td>\n      <td>5977700</td>\n      <td>1009600</td>\n    </tr>\n    <tr>\n      <th>16</th>\n      <td>1976-01-01</td>\n      <td>214659000</td>\n      <td>11349700</td>\n      <td>1004210</td>\n      <td>10345500</td>\n      <td>18780</td>\n      <td>57080</td>\n      <td>427810</td>\n      <td>500530</td>\n      <td>3108700</td>\n      <td>6270800</td>\n      <td>966000</td>\n    </tr>\n    <tr>\n      <th>17</th>\n      <td>1977-01-01</td>\n      <td>216332000</td>\n      <td>10984500</td>\n      <td>1029580</td>\n      <td>9955000</td>\n      <td>19120</td>\n      <td>63500</td>\n      <td>412610</td>\n      <td>534350</td>\n      <td>3071500</td>\n      <td>5905700</td>\n      <td>977700</td>\n    </tr>\n    <tr>\n      <th>18</th>\n      <td>1978-01-01</td>\n      <td>218059000</td>\n      <td>11209000</td>\n      <td>1085550</td>\n      <td>10123400</td>\n      <td>19560</td>\n      <td>67610</td>\n      <td>426930</td>\n      <td>571460</td>\n      <td>3128300</td>\n      <td>5991000</td>\n      <td>1004100</td>\n    </tr>\n    <tr>\n      <th>19</th>\n      <td>1979-01-01</td>\n      <td>220099000</td>\n      <td>12249500</td>\n      <td>1208030</td>\n      <td>11041500</td>\n      <td>21460</td>\n      <td>76390</td>\n      <td>480700</td>\n      <td>629480</td>\n      <td>3327700</td>\n      <td>6601000</td>\n      <td>1112800</td>\n    </tr>\n    <tr>\n      <th>20</th>\n      <td>1980-01-01</td>\n      <td>225349264</td>\n      <td>13408300</td>\n      <td>1344520</td>\n      <td>12063700</td>\n      <td>23040</td>\n      <td>82990</td>\n      <td>565840</td>\n      <td>672650</td>\n      <td>3795200</td>\n      <td>7136900</td>\n      <td>1131700</td>\n    </tr>\n    <tr>\n      <th>21</th>\n      <td>1981-01-01</td>\n      <td>229146000</td>\n      <td>13423800</td>\n      <td>1361820</td>\n      <td>12061900</td>\n      <td>22520</td>\n      <td>82500</td>\n      <td>592910</td>\n      <td>663900</td>\n      <td>3779700</td>\n      <td>7194400</td>\n      <td>1087800</td>\n    </tr>\n    <tr>\n      <th>22</th>\n      <td>1982-01-01</td>\n      <td>231534000</td>\n      <td>12974400</td>\n      <td>1322390</td>\n      <td>11652000</td>\n      <td>21010</td>\n      <td>78770</td>\n      <td>553130</td>\n      <td>669480</td>\n      <td>3447100</td>\n      <td>7142500</td>\n      <td>1062400</td>\n    </tr>\n    <tr>\n      <th>23</th>\n      <td>1983-01-01</td>\n      <td>233981000</td>\n      <td>12108600</td>\n      <td>1258090</td>\n      <td>10850500</td>\n      <td>19310</td>\n      <td>78920</td>\n      <td>506570</td>\n      <td>653290</td>\n      <td>3129900</td>\n      <td>6712800</td>\n      <td>1007900</td>\n    </tr>\n    <tr>\n      <th>24</th>\n      <td>1984-01-01</td>\n      <td>236158000</td>\n      <td>11881800</td>\n      <td>1273280</td>\n      <td>10608500</td>\n      <td>18690</td>\n      <td>84230</td>\n      <td>485010</td>\n      <td>685350</td>\n      <td>2984400</td>\n      <td>6591900</td>\n      <td>1032200</td>\n    </tr>\n    <tr>\n      <th>25</th>\n      <td>1985-01-01</td>\n      <td>238740000</td>\n      <td>12431400</td>\n      <td>1328800</td>\n      <td>11102600</td>\n      <td>18980</td>\n      <td>88670</td>\n      <td>497870</td>\n      <td>723250</td>\n      <td>3073300</td>\n      <td>6926400</td>\n      <td>1102900</td>\n    </tr>\n    <tr>\n      <th>26</th>\n      <td>1986-01-01</td>\n      <td>240132887</td>\n      <td>13211869</td>\n      <td>1489169</td>\n      <td>11722700</td>\n      <td>20613</td>\n      <td>91459</td>\n      <td>542775</td>\n      <td>834322</td>\n      <td>3241410</td>\n      <td>7257153</td>\n      <td>1224137</td>\n    </tr>\n    <tr>\n      <th>27</th>\n      <td>1987-01-01</td>\n      <td>242282918</td>\n      <td>13508700</td>\n      <td>1483999</td>\n      <td>12024700</td>\n      <td>20096</td>\n      <td>91110</td>\n      <td>517704</td>\n      <td>855088</td>\n      <td>3236184</td>\n      <td>7499900</td>\n      <td>1288674</td>\n    </tr>\n    <tr>\n      <th>28</th>\n      <td>1988-01-01</td>\n      <td>245807000</td>\n      <td>13923100</td>\n      <td>1566220</td>\n      <td>12356900</td>\n      <td>20680</td>\n      <td>92490</td>\n      <td>542970</td>\n      <td>910090</td>\n      <td>3218100</td>\n      <td>7705900</td>\n      <td>1432900</td>\n    </tr>\n    <tr>\n      <th>29</th>\n      <td>1989-01-01</td>\n      <td>248239000</td>\n      <td>14251400</td>\n      <td>1646040</td>\n      <td>12605400</td>\n      <td>21500</td>\n      <td>94500</td>\n      <td>578330</td>\n      <td>951710</td>\n      <td>3168200</td>\n      <td>7872400</td>\n      <td>1564800</td>\n    </tr>\n    <tr>\n      <th>30</th>\n      <td>1990-01-01</td>\n      <td>248709873</td>\n      <td>14475600</td>\n      <td>1820130</td>\n      <td>12655500</td>\n      <td>23440</td>\n      <td>102560</td>\n      <td>639270</td>\n      <td>1054860</td>\n      <td>3073900</td>\n      <td>7945700</td>\n      <td>1635900</td>\n    </tr>\n    <tr>\n      <th>31</th>\n      <td>1991-01-01</td>\n      <td>252177000</td>\n      <td>14872900</td>\n      <td>1911770</td>\n      <td>12961100</td>\n      <td>24700</td>\n      <td>106590</td>\n      <td>687730</td>\n      <td>1092740</td>\n      <td>3157200</td>\n      <td>8142200</td>\n      <td>1661700</td>\n    </tr>\n    <tr>\n      <th>32</th>\n      <td>1992-01-01</td>\n      <td>255082000</td>\n      <td>14438200</td>\n      <td>1932270</td>\n      <td>12505900</td>\n      <td>23760</td>\n      <td>109060</td>\n      <td>672480</td>\n      <td>1126970</td>\n      <td>2979900</td>\n      <td>7915200</td>\n      <td>1610800</td>\n    </tr>\n    <tr>\n      <th>33</th>\n      <td>1993-01-01</td>\n      <td>257908000</td>\n      <td>14144800</td>\n      <td>1926020</td>\n      <td>12218800</td>\n      <td>24530</td>\n      <td>106010</td>\n      <td>659870</td>\n      <td>1135610</td>\n      <td>2834800</td>\n      <td>7820900</td>\n      <td>1563100</td>\n    </tr>\n    <tr>\n      <th>34</th>\n      <td>1994-01-01</td>\n      <td>260341000</td>\n      <td>13989500</td>\n      <td>1857670</td>\n      <td>12131900</td>\n      <td>23330</td>\n      <td>102220</td>\n      <td>618950</td>\n      <td>1113180</td>\n      <td>2712800</td>\n      <td>7879800</td>\n      <td>1539300</td>\n    </tr>\n    <tr>\n      <th>35</th>\n      <td>1995-01-01</td>\n      <td>262755000</td>\n      <td>13862700</td>\n      <td>1798790</td>\n      <td>12063900</td>\n      <td>21610</td>\n      <td>97470</td>\n      <td>580510</td>\n      <td>1099210</td>\n      <td>2593800</td>\n      <td>7997700</td>\n      <td>1472400</td>\n    </tr>\n    <tr>\n      <th>36</th>\n      <td>1996-01-01</td>\n      <td>265228572</td>\n      <td>13493863</td>\n      <td>1688540</td>\n      <td>11805300</td>\n      <td>19650</td>\n      <td>96250</td>\n      <td>535590</td>\n      <td>1037050</td>\n      <td>2506400</td>\n      <td>7904700</td>\n      <td>1394200</td>\n    </tr>\n    <tr>\n      <th>37</th>\n      <td>1997-01-01</td>\n      <td>267637000</td>\n      <td>13194571</td>\n      <td>1634770</td>\n      <td>11558175</td>\n      <td>18208</td>\n      <td>96153</td>\n      <td>498534</td>\n      <td>1023201</td>\n      <td>2460526</td>\n      <td>7743760</td>\n      <td>1354189</td>\n    </tr>\n    <tr>\n      <th>38</th>\n      <td>1998-01-01</td>\n      <td>270296000</td>\n      <td>12475634</td>\n      <td>1531044</td>\n      <td>10944590</td>\n      <td>16914</td>\n      <td>93103</td>\n      <td>446625</td>\n      <td>974402</td>\n      <td>2329950</td>\n      <td>7373886</td>\n      <td>1240754</td>\n    </tr>\n    <tr>\n      <th>39</th>\n      <td>1999-01-01</td>\n      <td>272690813</td>\n      <td>11634378</td>\n      <td>1426044</td>\n      <td>10208334</td>\n      <td>15522</td>\n      <td>89411</td>\n      <td>409371</td>\n      <td>911740</td>\n      <td>2100739</td>\n      <td>6955520</td>\n      <td>1152075</td>\n    </tr>\n    <tr>\n      <th>40</th>\n      <td>2000-01-01</td>\n      <td>281421906</td>\n      <td>11608072</td>\n      <td>1425486</td>\n      <td>10182586</td>\n      <td>15586</td>\n      <td>90178</td>\n      <td>408016</td>\n      <td>911706</td>\n      <td>2050992</td>\n      <td>6971590</td>\n      <td>1160002</td>\n    </tr>\n    <tr>\n      <th>41</th>\n      <td>2001-01-01</td>\n      <td>285317559</td>\n      <td>11876669</td>\n      <td>1439480</td>\n      <td>10437480</td>\n      <td>16037</td>\n      <td>90863</td>\n      <td>423557</td>\n      <td>909023</td>\n      <td>2116531</td>\n      <td>7092267</td>\n      <td>1228391</td>\n    </tr>\n    <tr>\n      <th>42</th>\n      <td>2002-01-01</td>\n      <td>287973924</td>\n      <td>11878954</td>\n      <td>1423677</td>\n      <td>10455277</td>\n      <td>16229</td>\n      <td>95235</td>\n      <td>420806</td>\n      <td>891407</td>\n      <td>2151252</td>\n      <td>7057370</td>\n      <td>1246646</td>\n    </tr>\n    <tr>\n      <th>43</th>\n      <td>2003-01-01</td>\n      <td>290690788</td>\n      <td>11826538</td>\n      <td>1383676</td>\n      <td>10442862</td>\n      <td>16528</td>\n      <td>93883</td>\n      <td>414235</td>\n      <td>859030</td>\n      <td>2154834</td>\n      <td>7026802</td>\n      <td>1261226</td>\n    </tr>\n    <tr>\n      <th>44</th>\n      <td>2004-01-01</td>\n      <td>293656842</td>\n      <td>11679474</td>\n      <td>1360088</td>\n      <td>10319386</td>\n      <td>16148</td>\n      <td>95089</td>\n      <td>401470</td>\n      <td>847381</td>\n      <td>2144446</td>\n      <td>6937089</td>\n      <td>1237851</td>\n    </tr>\n    <tr>\n      <th>45</th>\n      <td>2005-01-01</td>\n      <td>296507061</td>\n      <td>11565499</td>\n      <td>1390745</td>\n      <td>10174754</td>\n      <td>16740</td>\n      <td>94347</td>\n      <td>417438</td>\n      <td>862220</td>\n      <td>2155448</td>\n      <td>6783447</td>\n      <td>1235859</td>\n    </tr>\n    <tr>\n      <th>46</th>\n      <td>2006-01-01</td>\n      <td>299398484</td>\n      <td>11401511</td>\n      <td>1418043</td>\n      <td>9983568</td>\n      <td>17030</td>\n      <td>92757</td>\n      <td>447403</td>\n      <td>860853</td>\n      <td>2183746</td>\n      <td>6607013</td>\n      <td>1192809</td>\n    </tr>\n    <tr>\n      <th>47</th>\n      <td>2007-01-01</td>\n      <td>301621157</td>\n      <td>11251828</td>\n      <td>1408337</td>\n      <td>9843481</td>\n      <td>16929</td>\n      <td>90427</td>\n      <td>445125</td>\n      <td>855856</td>\n      <td>2176140</td>\n      <td>6568572</td>\n      <td>1095769</td>\n    </tr>\n    <tr>\n      <th>48</th>\n      <td>2008-01-01</td>\n      <td>304374846</td>\n      <td>11160543</td>\n      <td>1392628</td>\n      <td>9767915</td>\n      <td>16442</td>\n      <td>90479</td>\n      <td>443574</td>\n      <td>842134</td>\n      <td>2228474</td>\n      <td>6588046</td>\n      <td>958629</td>\n    </tr>\n    <tr>\n      <th>49</th>\n      <td>2009-01-01</td>\n      <td>307006550</td>\n      <td>10762956</td>\n      <td>1325896</td>\n      <td>9337060</td>\n      <td>15399</td>\n      <td>89241</td>\n      <td>408742</td>\n      <td>812514</td>\n      <td>2203313</td>\n      <td>6338095</td>\n      <td>795652</td>\n    </tr>\n    <tr>\n      <th>50</th>\n      <td>2010-01-01</td>\n      <td>309330219</td>\n      <td>10363873</td>\n      <td>1251248</td>\n      <td>9112625</td>\n      <td>14772</td>\n      <td>85593</td>\n      <td>369089</td>\n      <td>781844</td>\n      <td>2168457</td>\n      <td>6204601</td>\n      <td>739565</td>\n    </tr>\n    <tr>\n      <th>51</th>\n      <td>2011-01-01</td>\n      <td>311587816</td>\n      <td>10258774</td>\n      <td>1206031</td>\n      <td>9052743</td>\n      <td>14661</td>\n      <td>84175</td>\n      <td>354772</td>\n      <td>752423</td>\n      <td>2185140</td>\n      <td>6151095</td>\n      <td>716508</td>\n    </tr>\n    <tr>\n      <th>52</th>\n      <td>2012-01-01</td>\n      <td>313873685</td>\n      <td>10219059</td>\n      <td>1217067</td>\n      <td>9001992</td>\n      <td>14866</td>\n      <td>85141</td>\n      <td>355051</td>\n      <td>762009</td>\n      <td>2109932</td>\n      <td>6168874</td>\n      <td>723186</td>\n    </tr>\n    <tr>\n      <th>53</th>\n      <td>2013-01-01</td>\n      <td>316497531</td>\n      <td>9850445</td>\n      <td>1199684</td>\n      <td>8650761</td>\n      <td>14319</td>\n      <td>82109</td>\n      <td>345095</td>\n      <td>726575</td>\n      <td>1931835</td>\n      <td>6018632</td>\n      <td>700294</td>\n    </tr>\n    <tr>\n      <th>54</th>\n      <td>2014-01-01</td>\n      <td>318857056</td>\n      <td>9475816</td>\n      <td>1197987</td>\n      <td>8277829</td>\n      <td>14249</td>\n      <td>84041</td>\n      <td>325802</td>\n      <td>741291</td>\n      <td>1729806</td>\n      <td>5858496</td>\n      <td>689527</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "crime['Year'] = pd.to_datetime(crime['Year'], format='%Y')\n",
    "crime"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 6. Set the Year column as the index of the dataframe"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T09:26:56.620314Z",
     "start_time": "2024-01-13T09:26:56.523168Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "            Population     Total  Violent  Property  Murder  Forcible_Rape  \\\nYear                                                                         \n1960-01-01   179323175   3384200   288460   3095700    9110          17190   \n1961-01-01   182992000   3488000   289390   3198600    8740          17220   \n1962-01-01   185771000   3752200   301510   3450700    8530          17550   \n1963-01-01   188483000   4109500   316970   3792500    8640          17650   \n1964-01-01   191141000   4564600   364220   4200400    9360          21420   \n1965-01-01   193526000   4739400   387390   4352000    9960          23410   \n1966-01-01   195576000   5223500   430180   4793300   11040          25820   \n1967-01-01   197457000   5903400   499930   5403500   12240          27620   \n1968-01-01   199399000   6720200   595010   6125200   13800          31670   \n1969-01-01   201385000   7410900   661870   6749000   14760          37170   \n1970-01-01   203235298   8098000   738820   7359200   16000          37990   \n1971-01-01   206212000   8588200   816500   7771700   17780          42260   \n1972-01-01   208230000   8248800   834900   7413900   18670          46850   \n1973-01-01   209851000   8718100   875910   7842200   19640          51400   \n1974-01-01   211392000  10253400   974720   9278700   20710          55400   \n1975-01-01   213124000  11292400  1039710  10252700   20510          56090   \n1976-01-01   214659000  11349700  1004210  10345500   18780          57080   \n1977-01-01   216332000  10984500  1029580   9955000   19120          63500   \n1978-01-01   218059000  11209000  1085550  10123400   19560          67610   \n1979-01-01   220099000  12249500  1208030  11041500   21460          76390   \n1980-01-01   225349264  13408300  1344520  12063700   23040          82990   \n1981-01-01   229146000  13423800  1361820  12061900   22520          82500   \n1982-01-01   231534000  12974400  1322390  11652000   21010          78770   \n1983-01-01   233981000  12108600  1258090  10850500   19310          78920   \n1984-01-01   236158000  11881800  1273280  10608500   18690          84230   \n1985-01-01   238740000  12431400  1328800  11102600   18980          88670   \n1986-01-01   240132887  13211869  1489169  11722700   20613          91459   \n1987-01-01   242282918  13508700  1483999  12024700   20096          91110   \n1988-01-01   245807000  13923100  1566220  12356900   20680          92490   \n1989-01-01   248239000  14251400  1646040  12605400   21500          94500   \n1990-01-01   248709873  14475600  1820130  12655500   23440         102560   \n1991-01-01   252177000  14872900  1911770  12961100   24700         106590   \n1992-01-01   255082000  14438200  1932270  12505900   23760         109060   \n1993-01-01   257908000  14144800  1926020  12218800   24530         106010   \n1994-01-01   260341000  13989500  1857670  12131900   23330         102220   \n1995-01-01   262755000  13862700  1798790  12063900   21610          97470   \n1996-01-01   265228572  13493863  1688540  11805300   19650          96250   \n1997-01-01   267637000  13194571  1634770  11558175   18208          96153   \n1998-01-01   270296000  12475634  1531044  10944590   16914          93103   \n1999-01-01   272690813  11634378  1426044  10208334   15522          89411   \n2000-01-01   281421906  11608072  1425486  10182586   15586          90178   \n2001-01-01   285317559  11876669  1439480  10437480   16037          90863   \n2002-01-01   287973924  11878954  1423677  10455277   16229          95235   \n2003-01-01   290690788  11826538  1383676  10442862   16528          93883   \n2004-01-01   293656842  11679474  1360088  10319386   16148          95089   \n2005-01-01   296507061  11565499  1390745  10174754   16740          94347   \n2006-01-01   299398484  11401511  1418043   9983568   17030          92757   \n2007-01-01   301621157  11251828  1408337   9843481   16929          90427   \n2008-01-01   304374846  11160543  1392628   9767915   16442          90479   \n2009-01-01   307006550  10762956  1325896   9337060   15399          89241   \n2010-01-01   309330219  10363873  1251248   9112625   14772          85593   \n2011-01-01   311587816  10258774  1206031   9052743   14661          84175   \n2012-01-01   313873685  10219059  1217067   9001992   14866          85141   \n2013-01-01   316497531   9850445  1199684   8650761   14319          82109   \n2014-01-01   318857056   9475816  1197987   8277829   14249          84041   \n\n            Robbery  Aggravated_assault  Burglary  Larceny_Theft  \\\nYear                                                               \n1960-01-01   107840              154320    912100        1855400   \n1961-01-01   106670              156760    949600        1913000   \n1962-01-01   110860              164570    994300        2089600   \n1963-01-01   116470              174210   1086400        2297800   \n1964-01-01   130390              203050   1213200        2514400   \n1965-01-01   138690              215330   1282500        2572600   \n1966-01-01   157990              235330   1410100        2822000   \n1967-01-01   202910              257160   1632100        3111600   \n1968-01-01   262840              286700   1858900        3482700   \n1969-01-01   298850              311090   1981900        3888600   \n1970-01-01   349860              334970   2205000        4225800   \n1971-01-01   387700              368760   2399300        4424200   \n1972-01-01   376290              393090   2375500        4151200   \n1973-01-01   384220              420650   2565500        4347900   \n1974-01-01   442400              456210   3039200        5262500   \n1975-01-01   470500              492620   3265300        5977700   \n1976-01-01   427810              500530   3108700        6270800   \n1977-01-01   412610              534350   3071500        5905700   \n1978-01-01   426930              571460   3128300        5991000   \n1979-01-01   480700              629480   3327700        6601000   \n1980-01-01   565840              672650   3795200        7136900   \n1981-01-01   592910              663900   3779700        7194400   \n1982-01-01   553130              669480   3447100        7142500   \n1983-01-01   506570              653290   3129900        6712800   \n1984-01-01   485010              685350   2984400        6591900   \n1985-01-01   497870              723250   3073300        6926400   \n1986-01-01   542775              834322   3241410        7257153   \n1987-01-01   517704              855088   3236184        7499900   \n1988-01-01   542970              910090   3218100        7705900   \n1989-01-01   578330              951710   3168200        7872400   \n1990-01-01   639270             1054860   3073900        7945700   \n1991-01-01   687730             1092740   3157200        8142200   \n1992-01-01   672480             1126970   2979900        7915200   \n1993-01-01   659870             1135610   2834800        7820900   \n1994-01-01   618950             1113180   2712800        7879800   \n1995-01-01   580510             1099210   2593800        7997700   \n1996-01-01   535590             1037050   2506400        7904700   \n1997-01-01   498534             1023201   2460526        7743760   \n1998-01-01   446625              974402   2329950        7373886   \n1999-01-01   409371              911740   2100739        6955520   \n2000-01-01   408016              911706   2050992        6971590   \n2001-01-01   423557              909023   2116531        7092267   \n2002-01-01   420806              891407   2151252        7057370   \n2003-01-01   414235              859030   2154834        7026802   \n2004-01-01   401470              847381   2144446        6937089   \n2005-01-01   417438              862220   2155448        6783447   \n2006-01-01   447403              860853   2183746        6607013   \n2007-01-01   445125              855856   2176140        6568572   \n2008-01-01   443574              842134   2228474        6588046   \n2009-01-01   408742              812514   2203313        6338095   \n2010-01-01   369089              781844   2168457        6204601   \n2011-01-01   354772              752423   2185140        6151095   \n2012-01-01   355051              762009   2109932        6168874   \n2013-01-01   345095              726575   1931835        6018632   \n2014-01-01   325802              741291   1729806        5858496   \n\n            Vehicle_Theft  \nYear                       \n1960-01-01         328200  \n1961-01-01         336000  \n1962-01-01         366800  \n1963-01-01         408300  \n1964-01-01         472800  \n1965-01-01         496900  \n1966-01-01         561200  \n1967-01-01         659800  \n1968-01-01         783600  \n1969-01-01         878500  \n1970-01-01         928400  \n1971-01-01         948200  \n1972-01-01         887200  \n1973-01-01         928800  \n1974-01-01         977100  \n1975-01-01        1009600  \n1976-01-01         966000  \n1977-01-01         977700  \n1978-01-01        1004100  \n1979-01-01        1112800  \n1980-01-01        1131700  \n1981-01-01        1087800  \n1982-01-01        1062400  \n1983-01-01        1007900  \n1984-01-01        1032200  \n1985-01-01        1102900  \n1986-01-01        1224137  \n1987-01-01        1288674  \n1988-01-01        1432900  \n1989-01-01        1564800  \n1990-01-01        1635900  \n1991-01-01        1661700  \n1992-01-01        1610800  \n1993-01-01        1563100  \n1994-01-01        1539300  \n1995-01-01        1472400  \n1996-01-01        1394200  \n1997-01-01        1354189  \n1998-01-01        1240754  \n1999-01-01        1152075  \n2000-01-01        1160002  \n2001-01-01        1228391  \n2002-01-01        1246646  \n2003-01-01        1261226  \n2004-01-01        1237851  \n2005-01-01        1235859  \n2006-01-01        1192809  \n2007-01-01        1095769  \n2008-01-01         958629  \n2009-01-01         795652  \n2010-01-01         739565  \n2011-01-01         716508  \n2012-01-01         723186  \n2013-01-01         700294  \n2014-01-01         689527  ",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Population</th>\n      <th>Total</th>\n      <th>Violent</th>\n      <th>Property</th>\n      <th>Murder</th>\n      <th>Forcible_Rape</th>\n      <th>Robbery</th>\n      <th>Aggravated_assault</th>\n      <th>Burglary</th>\n      <th>Larceny_Theft</th>\n      <th>Vehicle_Theft</th>\n    </tr>\n    <tr>\n      <th>Year</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>1960-01-01</th>\n      <td>179323175</td>\n      <td>3384200</td>\n      <td>288460</td>\n      <td>3095700</td>\n      <td>9110</td>\n      <td>17190</td>\n      <td>107840</td>\n      <td>154320</td>\n      <td>912100</td>\n      <td>1855400</td>\n      <td>328200</td>\n    </tr>\n    <tr>\n      <th>1961-01-01</th>\n      <td>182992000</td>\n      <td>3488000</td>\n      <td>289390</td>\n      <td>3198600</td>\n      <td>8740</td>\n      <td>17220</td>\n      <td>106670</td>\n      <td>156760</td>\n      <td>949600</td>\n      <td>1913000</td>\n      <td>336000</td>\n    </tr>\n    <tr>\n      <th>1962-01-01</th>\n      <td>185771000</td>\n      <td>3752200</td>\n      <td>301510</td>\n      <td>3450700</td>\n      <td>8530</td>\n      <td>17550</td>\n      <td>110860</td>\n      <td>164570</td>\n      <td>994300</td>\n      <td>2089600</td>\n      <td>366800</td>\n    </tr>\n    <tr>\n      <th>1963-01-01</th>\n      <td>188483000</td>\n      <td>4109500</td>\n      <td>316970</td>\n      <td>3792500</td>\n      <td>8640</td>\n      <td>17650</td>\n      <td>116470</td>\n      <td>174210</td>\n      <td>1086400</td>\n      <td>2297800</td>\n      <td>408300</td>\n    </tr>\n    <tr>\n      <th>1964-01-01</th>\n      <td>191141000</td>\n      <td>4564600</td>\n      <td>364220</td>\n      <td>4200400</td>\n      <td>9360</td>\n      <td>21420</td>\n      <td>130390</td>\n      <td>203050</td>\n      <td>1213200</td>\n      <td>2514400</td>\n      <td>472800</td>\n    </tr>\n    <tr>\n      <th>1965-01-01</th>\n      <td>193526000</td>\n      <td>4739400</td>\n      <td>387390</td>\n      <td>4352000</td>\n      <td>9960</td>\n      <td>23410</td>\n      <td>138690</td>\n      <td>215330</td>\n      <td>1282500</td>\n      <td>2572600</td>\n      <td>496900</td>\n    </tr>\n    <tr>\n      <th>1966-01-01</th>\n      <td>195576000</td>\n      <td>5223500</td>\n      <td>430180</td>\n      <td>4793300</td>\n      <td>11040</td>\n      <td>25820</td>\n      <td>157990</td>\n      <td>235330</td>\n      <td>1410100</td>\n      <td>2822000</td>\n      <td>561200</td>\n    </tr>\n    <tr>\n      <th>1967-01-01</th>\n      <td>197457000</td>\n      <td>5903400</td>\n      <td>499930</td>\n      <td>5403500</td>\n      <td>12240</td>\n      <td>27620</td>\n      <td>202910</td>\n      <td>257160</td>\n      <td>1632100</td>\n      <td>3111600</td>\n      <td>659800</td>\n    </tr>\n    <tr>\n      <th>1968-01-01</th>\n      <td>199399000</td>\n      <td>6720200</td>\n      <td>595010</td>\n      <td>6125200</td>\n      <td>13800</td>\n      <td>31670</td>\n      <td>262840</td>\n      <td>286700</td>\n      <td>1858900</td>\n      <td>3482700</td>\n      <td>783600</td>\n    </tr>\n    <tr>\n      <th>1969-01-01</th>\n      <td>201385000</td>\n      <td>7410900</td>\n      <td>661870</td>\n      <td>6749000</td>\n      <td>14760</td>\n      <td>37170</td>\n      <td>298850</td>\n      <td>311090</td>\n      <td>1981900</td>\n      <td>3888600</td>\n      <td>878500</td>\n    </tr>\n    <tr>\n      <th>1970-01-01</th>\n      <td>203235298</td>\n      <td>8098000</td>\n      <td>738820</td>\n      <td>7359200</td>\n      <td>16000</td>\n      <td>37990</td>\n      <td>349860</td>\n      <td>334970</td>\n      <td>2205000</td>\n      <td>4225800</td>\n      <td>928400</td>\n    </tr>\n    <tr>\n      <th>1971-01-01</th>\n      <td>206212000</td>\n      <td>8588200</td>\n      <td>816500</td>\n      <td>7771700</td>\n      <td>17780</td>\n      <td>42260</td>\n      <td>387700</td>\n      <td>368760</td>\n      <td>2399300</td>\n      <td>4424200</td>\n      <td>948200</td>\n    </tr>\n    <tr>\n      <th>1972-01-01</th>\n      <td>208230000</td>\n      <td>8248800</td>\n      <td>834900</td>\n      <td>7413900</td>\n      <td>18670</td>\n      <td>46850</td>\n      <td>376290</td>\n      <td>393090</td>\n      <td>2375500</td>\n      <td>4151200</td>\n      <td>887200</td>\n    </tr>\n    <tr>\n      <th>1973-01-01</th>\n      <td>209851000</td>\n      <td>8718100</td>\n      <td>875910</td>\n      <td>7842200</td>\n      <td>19640</td>\n      <td>51400</td>\n      <td>384220</td>\n      <td>420650</td>\n      <td>2565500</td>\n      <td>4347900</td>\n      <td>928800</td>\n    </tr>\n    <tr>\n      <th>1974-01-01</th>\n      <td>211392000</td>\n      <td>10253400</td>\n      <td>974720</td>\n      <td>9278700</td>\n      <td>20710</td>\n      <td>55400</td>\n      <td>442400</td>\n      <td>456210</td>\n      <td>3039200</td>\n      <td>5262500</td>\n      <td>977100</td>\n    </tr>\n    <tr>\n      <th>1975-01-01</th>\n      <td>213124000</td>\n      <td>11292400</td>\n      <td>1039710</td>\n      <td>10252700</td>\n      <td>20510</td>\n      <td>56090</td>\n      <td>470500</td>\n      <td>492620</td>\n      <td>3265300</td>\n      <td>5977700</td>\n      <td>1009600</td>\n    </tr>\n    <tr>\n      <th>1976-01-01</th>\n      <td>214659000</td>\n      <td>11349700</td>\n      <td>1004210</td>\n      <td>10345500</td>\n      <td>18780</td>\n      <td>57080</td>\n      <td>427810</td>\n      <td>500530</td>\n      <td>3108700</td>\n      <td>6270800</td>\n      <td>966000</td>\n    </tr>\n    <tr>\n      <th>1977-01-01</th>\n      <td>216332000</td>\n      <td>10984500</td>\n      <td>1029580</td>\n      <td>9955000</td>\n      <td>19120</td>\n      <td>63500</td>\n      <td>412610</td>\n      <td>534350</td>\n      <td>3071500</td>\n      <td>5905700</td>\n      <td>977700</td>\n    </tr>\n    <tr>\n      <th>1978-01-01</th>\n      <td>218059000</td>\n      <td>11209000</td>\n      <td>1085550</td>\n      <td>10123400</td>\n      <td>19560</td>\n      <td>67610</td>\n      <td>426930</td>\n      <td>571460</td>\n      <td>3128300</td>\n      <td>5991000</td>\n      <td>1004100</td>\n    </tr>\n    <tr>\n      <th>1979-01-01</th>\n      <td>220099000</td>\n      <td>12249500</td>\n      <td>1208030</td>\n      <td>11041500</td>\n      <td>21460</td>\n      <td>76390</td>\n      <td>480700</td>\n      <td>629480</td>\n      <td>3327700</td>\n      <td>6601000</td>\n      <td>1112800</td>\n    </tr>\n    <tr>\n      <th>1980-01-01</th>\n      <td>225349264</td>\n      <td>13408300</td>\n      <td>1344520</td>\n      <td>12063700</td>\n      <td>23040</td>\n      <td>82990</td>\n      <td>565840</td>\n      <td>672650</td>\n      <td>3795200</td>\n      <td>7136900</td>\n      <td>1131700</td>\n    </tr>\n    <tr>\n      <th>1981-01-01</th>\n      <td>229146000</td>\n      <td>13423800</td>\n      <td>1361820</td>\n      <td>12061900</td>\n      <td>22520</td>\n      <td>82500</td>\n      <td>592910</td>\n      <td>663900</td>\n      <td>3779700</td>\n      <td>7194400</td>\n      <td>1087800</td>\n    </tr>\n    <tr>\n      <th>1982-01-01</th>\n      <td>231534000</td>\n      <td>12974400</td>\n      <td>1322390</td>\n      <td>11652000</td>\n      <td>21010</td>\n      <td>78770</td>\n      <td>553130</td>\n      <td>669480</td>\n      <td>3447100</td>\n      <td>7142500</td>\n      <td>1062400</td>\n    </tr>\n    <tr>\n      <th>1983-01-01</th>\n      <td>233981000</td>\n      <td>12108600</td>\n      <td>1258090</td>\n      <td>10850500</td>\n      <td>19310</td>\n      <td>78920</td>\n      <td>506570</td>\n      <td>653290</td>\n      <td>3129900</td>\n      <td>6712800</td>\n      <td>1007900</td>\n    </tr>\n    <tr>\n      <th>1984-01-01</th>\n      <td>236158000</td>\n      <td>11881800</td>\n      <td>1273280</td>\n      <td>10608500</td>\n      <td>18690</td>\n      <td>84230</td>\n      <td>485010</td>\n      <td>685350</td>\n      <td>2984400</td>\n      <td>6591900</td>\n      <td>1032200</td>\n    </tr>\n    <tr>\n      <th>1985-01-01</th>\n      <td>238740000</td>\n      <td>12431400</td>\n      <td>1328800</td>\n      <td>11102600</td>\n      <td>18980</td>\n      <td>88670</td>\n      <td>497870</td>\n      <td>723250</td>\n      <td>3073300</td>\n      <td>6926400</td>\n      <td>1102900</td>\n    </tr>\n    <tr>\n      <th>1986-01-01</th>\n      <td>240132887</td>\n      <td>13211869</td>\n      <td>1489169</td>\n      <td>11722700</td>\n      <td>20613</td>\n      <td>91459</td>\n      <td>542775</td>\n      <td>834322</td>\n      <td>3241410</td>\n      <td>7257153</td>\n      <td>1224137</td>\n    </tr>\n    <tr>\n      <th>1987-01-01</th>\n      <td>242282918</td>\n      <td>13508700</td>\n      <td>1483999</td>\n      <td>12024700</td>\n      <td>20096</td>\n      <td>91110</td>\n      <td>517704</td>\n      <td>855088</td>\n      <td>3236184</td>\n      <td>7499900</td>\n      <td>1288674</td>\n    </tr>\n    <tr>\n      <th>1988-01-01</th>\n      <td>245807000</td>\n      <td>13923100</td>\n      <td>1566220</td>\n      <td>12356900</td>\n      <td>20680</td>\n      <td>92490</td>\n      <td>542970</td>\n      <td>910090</td>\n      <td>3218100</td>\n      <td>7705900</td>\n      <td>1432900</td>\n    </tr>\n    <tr>\n      <th>1989-01-01</th>\n      <td>248239000</td>\n      <td>14251400</td>\n      <td>1646040</td>\n      <td>12605400</td>\n      <td>21500</td>\n      <td>94500</td>\n      <td>578330</td>\n      <td>951710</td>\n      <td>3168200</td>\n      <td>7872400</td>\n      <td>1564800</td>\n    </tr>\n    <tr>\n      <th>1990-01-01</th>\n      <td>248709873</td>\n      <td>14475600</td>\n      <td>1820130</td>\n      <td>12655500</td>\n      <td>23440</td>\n      <td>102560</td>\n      <td>639270</td>\n      <td>1054860</td>\n      <td>3073900</td>\n      <td>7945700</td>\n      <td>1635900</td>\n    </tr>\n    <tr>\n      <th>1991-01-01</th>\n      <td>252177000</td>\n      <td>14872900</td>\n      <td>1911770</td>\n      <td>12961100</td>\n      <td>24700</td>\n      <td>106590</td>\n      <td>687730</td>\n      <td>1092740</td>\n      <td>3157200</td>\n      <td>8142200</td>\n      <td>1661700</td>\n    </tr>\n    <tr>\n      <th>1992-01-01</th>\n      <td>255082000</td>\n      <td>14438200</td>\n      <td>1932270</td>\n      <td>12505900</td>\n      <td>23760</td>\n      <td>109060</td>\n      <td>672480</td>\n      <td>1126970</td>\n      <td>2979900</td>\n      <td>7915200</td>\n      <td>1610800</td>\n    </tr>\n    <tr>\n      <th>1993-01-01</th>\n      <td>257908000</td>\n      <td>14144800</td>\n      <td>1926020</td>\n      <td>12218800</td>\n      <td>24530</td>\n      <td>106010</td>\n      <td>659870</td>\n      <td>1135610</td>\n      <td>2834800</td>\n      <td>7820900</td>\n      <td>1563100</td>\n    </tr>\n    <tr>\n      <th>1994-01-01</th>\n      <td>260341000</td>\n      <td>13989500</td>\n      <td>1857670</td>\n      <td>12131900</td>\n      <td>23330</td>\n      <td>102220</td>\n      <td>618950</td>\n      <td>1113180</td>\n      <td>2712800</td>\n      <td>7879800</td>\n      <td>1539300</td>\n    </tr>\n    <tr>\n      <th>1995-01-01</th>\n      <td>262755000</td>\n      <td>13862700</td>\n      <td>1798790</td>\n      <td>12063900</td>\n      <td>21610</td>\n      <td>97470</td>\n      <td>580510</td>\n      <td>1099210</td>\n      <td>2593800</td>\n      <td>7997700</td>\n      <td>1472400</td>\n    </tr>\n    <tr>\n      <th>1996-01-01</th>\n      <td>265228572</td>\n      <td>13493863</td>\n      <td>1688540</td>\n      <td>11805300</td>\n      <td>19650</td>\n      <td>96250</td>\n      <td>535590</td>\n      <td>1037050</td>\n      <td>2506400</td>\n      <td>7904700</td>\n      <td>1394200</td>\n    </tr>\n    <tr>\n      <th>1997-01-01</th>\n      <td>267637000</td>\n      <td>13194571</td>\n      <td>1634770</td>\n      <td>11558175</td>\n      <td>18208</td>\n      <td>96153</td>\n      <td>498534</td>\n      <td>1023201</td>\n      <td>2460526</td>\n      <td>7743760</td>\n      <td>1354189</td>\n    </tr>\n    <tr>\n      <th>1998-01-01</th>\n      <td>270296000</td>\n      <td>12475634</td>\n      <td>1531044</td>\n      <td>10944590</td>\n      <td>16914</td>\n      <td>93103</td>\n      <td>446625</td>\n      <td>974402</td>\n      <td>2329950</td>\n      <td>7373886</td>\n      <td>1240754</td>\n    </tr>\n    <tr>\n      <th>1999-01-01</th>\n      <td>272690813</td>\n      <td>11634378</td>\n      <td>1426044</td>\n      <td>10208334</td>\n      <td>15522</td>\n      <td>89411</td>\n      <td>409371</td>\n      <td>911740</td>\n      <td>2100739</td>\n      <td>6955520</td>\n      <td>1152075</td>\n    </tr>\n    <tr>\n      <th>2000-01-01</th>\n      <td>281421906</td>\n      <td>11608072</td>\n      <td>1425486</td>\n      <td>10182586</td>\n      <td>15586</td>\n      <td>90178</td>\n      <td>408016</td>\n      <td>911706</td>\n      <td>2050992</td>\n      <td>6971590</td>\n      <td>1160002</td>\n    </tr>\n    <tr>\n      <th>2001-01-01</th>\n      <td>285317559</td>\n      <td>11876669</td>\n      <td>1439480</td>\n      <td>10437480</td>\n      <td>16037</td>\n      <td>90863</td>\n      <td>423557</td>\n      <td>909023</td>\n      <td>2116531</td>\n      <td>7092267</td>\n      <td>1228391</td>\n    </tr>\n    <tr>\n      <th>2002-01-01</th>\n      <td>287973924</td>\n      <td>11878954</td>\n      <td>1423677</td>\n      <td>10455277</td>\n      <td>16229</td>\n      <td>95235</td>\n      <td>420806</td>\n      <td>891407</td>\n      <td>2151252</td>\n      <td>7057370</td>\n      <td>1246646</td>\n    </tr>\n    <tr>\n      <th>2003-01-01</th>\n      <td>290690788</td>\n      <td>11826538</td>\n      <td>1383676</td>\n      <td>10442862</td>\n      <td>16528</td>\n      <td>93883</td>\n      <td>414235</td>\n      <td>859030</td>\n      <td>2154834</td>\n      <td>7026802</td>\n      <td>1261226</td>\n    </tr>\n    <tr>\n      <th>2004-01-01</th>\n      <td>293656842</td>\n      <td>11679474</td>\n      <td>1360088</td>\n      <td>10319386</td>\n      <td>16148</td>\n      <td>95089</td>\n      <td>401470</td>\n      <td>847381</td>\n      <td>2144446</td>\n      <td>6937089</td>\n      <td>1237851</td>\n    </tr>\n    <tr>\n      <th>2005-01-01</th>\n      <td>296507061</td>\n      <td>11565499</td>\n      <td>1390745</td>\n      <td>10174754</td>\n      <td>16740</td>\n      <td>94347</td>\n      <td>417438</td>\n      <td>862220</td>\n      <td>2155448</td>\n      <td>6783447</td>\n      <td>1235859</td>\n    </tr>\n    <tr>\n      <th>2006-01-01</th>\n      <td>299398484</td>\n      <td>11401511</td>\n      <td>1418043</td>\n      <td>9983568</td>\n      <td>17030</td>\n      <td>92757</td>\n      <td>447403</td>\n      <td>860853</td>\n      <td>2183746</td>\n      <td>6607013</td>\n      <td>1192809</td>\n    </tr>\n    <tr>\n      <th>2007-01-01</th>\n      <td>301621157</td>\n      <td>11251828</td>\n      <td>1408337</td>\n      <td>9843481</td>\n      <td>16929</td>\n      <td>90427</td>\n      <td>445125</td>\n      <td>855856</td>\n      <td>2176140</td>\n      <td>6568572</td>\n      <td>1095769</td>\n    </tr>\n    <tr>\n      <th>2008-01-01</th>\n      <td>304374846</td>\n      <td>11160543</td>\n      <td>1392628</td>\n      <td>9767915</td>\n      <td>16442</td>\n      <td>90479</td>\n      <td>443574</td>\n      <td>842134</td>\n      <td>2228474</td>\n      <td>6588046</td>\n      <td>958629</td>\n    </tr>\n    <tr>\n      <th>2009-01-01</th>\n      <td>307006550</td>\n      <td>10762956</td>\n      <td>1325896</td>\n      <td>9337060</td>\n      <td>15399</td>\n      <td>89241</td>\n      <td>408742</td>\n      <td>812514</td>\n      <td>2203313</td>\n      <td>6338095</td>\n      <td>795652</td>\n    </tr>\n    <tr>\n      <th>2010-01-01</th>\n      <td>309330219</td>\n      <td>10363873</td>\n      <td>1251248</td>\n      <td>9112625</td>\n      <td>14772</td>\n      <td>85593</td>\n      <td>369089</td>\n      <td>781844</td>\n      <td>2168457</td>\n      <td>6204601</td>\n      <td>739565</td>\n    </tr>\n    <tr>\n      <th>2011-01-01</th>\n      <td>311587816</td>\n      <td>10258774</td>\n      <td>1206031</td>\n      <td>9052743</td>\n      <td>14661</td>\n      <td>84175</td>\n      <td>354772</td>\n      <td>752423</td>\n      <td>2185140</td>\n      <td>6151095</td>\n      <td>716508</td>\n    </tr>\n    <tr>\n      <th>2012-01-01</th>\n      <td>313873685</td>\n      <td>10219059</td>\n      <td>1217067</td>\n      <td>9001992</td>\n      <td>14866</td>\n      <td>85141</td>\n      <td>355051</td>\n      <td>762009</td>\n      <td>2109932</td>\n      <td>6168874</td>\n      <td>723186</td>\n    </tr>\n    <tr>\n      <th>2013-01-01</th>\n      <td>316497531</td>\n      <td>9850445</td>\n      <td>1199684</td>\n      <td>8650761</td>\n      <td>14319</td>\n      <td>82109</td>\n      <td>345095</td>\n      <td>726575</td>\n      <td>1931835</td>\n      <td>6018632</td>\n      <td>700294</td>\n    </tr>\n    <tr>\n      <th>2014-01-01</th>\n      <td>318857056</td>\n      <td>9475816</td>\n      <td>1197987</td>\n      <td>8277829</td>\n      <td>14249</td>\n      <td>84041</td>\n      <td>325802</td>\n      <td>741291</td>\n      <td>1729806</td>\n      <td>5858496</td>\n      <td>689527</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 133,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "crime = crime.set_index('Year',drop=True)\n",
    "crime"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 7. Delete the Total column"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T09:26:56.630984Z",
     "start_time": "2024-01-13T09:26:56.555790Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "            Population  Violent  Property  Murder  Forcible_Rape  Robbery  \\\nYear                                                                        \n1960-01-01   179323175   288460   3095700    9110          17190   107840   \n1961-01-01   182992000   289390   3198600    8740          17220   106670   \n1962-01-01   185771000   301510   3450700    8530          17550   110860   \n1963-01-01   188483000   316970   3792500    8640          17650   116470   \n1964-01-01   191141000   364220   4200400    9360          21420   130390   \n1965-01-01   193526000   387390   4352000    9960          23410   138690   \n1966-01-01   195576000   430180   4793300   11040          25820   157990   \n1967-01-01   197457000   499930   5403500   12240          27620   202910   \n1968-01-01   199399000   595010   6125200   13800          31670   262840   \n1969-01-01   201385000   661870   6749000   14760          37170   298850   \n1970-01-01   203235298   738820   7359200   16000          37990   349860   \n1971-01-01   206212000   816500   7771700   17780          42260   387700   \n1972-01-01   208230000   834900   7413900   18670          46850   376290   \n1973-01-01   209851000   875910   7842200   19640          51400   384220   \n1974-01-01   211392000   974720   9278700   20710          55400   442400   \n1975-01-01   213124000  1039710  10252700   20510          56090   470500   \n1976-01-01   214659000  1004210  10345500   18780          57080   427810   \n1977-01-01   216332000  1029580   9955000   19120          63500   412610   \n1978-01-01   218059000  1085550  10123400   19560          67610   426930   \n1979-01-01   220099000  1208030  11041500   21460          76390   480700   \n1980-01-01   225349264  1344520  12063700   23040          82990   565840   \n1981-01-01   229146000  1361820  12061900   22520          82500   592910   \n1982-01-01   231534000  1322390  11652000   21010          78770   553130   \n1983-01-01   233981000  1258090  10850500   19310          78920   506570   \n1984-01-01   236158000  1273280  10608500   18690          84230   485010   \n1985-01-01   238740000  1328800  11102600   18980          88670   497870   \n1986-01-01   240132887  1489169  11722700   20613          91459   542775   \n1987-01-01   242282918  1483999  12024700   20096          91110   517704   \n1988-01-01   245807000  1566220  12356900   20680          92490   542970   \n1989-01-01   248239000  1646040  12605400   21500          94500   578330   \n1990-01-01   248709873  1820130  12655500   23440         102560   639270   \n1991-01-01   252177000  1911770  12961100   24700         106590   687730   \n1992-01-01   255082000  1932270  12505900   23760         109060   672480   \n1993-01-01   257908000  1926020  12218800   24530         106010   659870   \n1994-01-01   260341000  1857670  12131900   23330         102220   618950   \n1995-01-01   262755000  1798790  12063900   21610          97470   580510   \n1996-01-01   265228572  1688540  11805300   19650          96250   535590   \n1997-01-01   267637000  1634770  11558175   18208          96153   498534   \n1998-01-01   270296000  1531044  10944590   16914          93103   446625   \n1999-01-01   272690813  1426044  10208334   15522          89411   409371   \n2000-01-01   281421906  1425486  10182586   15586          90178   408016   \n2001-01-01   285317559  1439480  10437480   16037          90863   423557   \n2002-01-01   287973924  1423677  10455277   16229          95235   420806   \n2003-01-01   290690788  1383676  10442862   16528          93883   414235   \n2004-01-01   293656842  1360088  10319386   16148          95089   401470   \n2005-01-01   296507061  1390745  10174754   16740          94347   417438   \n2006-01-01   299398484  1418043   9983568   17030          92757   447403   \n2007-01-01   301621157  1408337   9843481   16929          90427   445125   \n2008-01-01   304374846  1392628   9767915   16442          90479   443574   \n2009-01-01   307006550  1325896   9337060   15399          89241   408742   \n2010-01-01   309330219  1251248   9112625   14772          85593   369089   \n2011-01-01   311587816  1206031   9052743   14661          84175   354772   \n2012-01-01   313873685  1217067   9001992   14866          85141   355051   \n2013-01-01   316497531  1199684   8650761   14319          82109   345095   \n2014-01-01   318857056  1197987   8277829   14249          84041   325802   \n\n            Aggravated_assault  Burglary  Larceny_Theft  Vehicle_Theft  \nYear                                                                    \n1960-01-01              154320    912100        1855400         328200  \n1961-01-01              156760    949600        1913000         336000  \n1962-01-01              164570    994300        2089600         366800  \n1963-01-01              174210   1086400        2297800         408300  \n1964-01-01              203050   1213200        2514400         472800  \n1965-01-01              215330   1282500        2572600         496900  \n1966-01-01              235330   1410100        2822000         561200  \n1967-01-01              257160   1632100        3111600         659800  \n1968-01-01              286700   1858900        3482700         783600  \n1969-01-01              311090   1981900        3888600         878500  \n1970-01-01              334970   2205000        4225800         928400  \n1971-01-01              368760   2399300        4424200         948200  \n1972-01-01              393090   2375500        4151200         887200  \n1973-01-01              420650   2565500        4347900         928800  \n1974-01-01              456210   3039200        5262500         977100  \n1975-01-01              492620   3265300        5977700        1009600  \n1976-01-01              500530   3108700        6270800         966000  \n1977-01-01              534350   3071500        5905700         977700  \n1978-01-01              571460   3128300        5991000        1004100  \n1979-01-01              629480   3327700        6601000        1112800  \n1980-01-01              672650   3795200        7136900        1131700  \n1981-01-01              663900   3779700        7194400        1087800  \n1982-01-01              669480   3447100        7142500        1062400  \n1983-01-01              653290   3129900        6712800        1007900  \n1984-01-01              685350   2984400        6591900        1032200  \n1985-01-01              723250   3073300        6926400        1102900  \n1986-01-01              834322   3241410        7257153        1224137  \n1987-01-01              855088   3236184        7499900        1288674  \n1988-01-01              910090   3218100        7705900        1432900  \n1989-01-01              951710   3168200        7872400        1564800  \n1990-01-01             1054860   3073900        7945700        1635900  \n1991-01-01             1092740   3157200        8142200        1661700  \n1992-01-01             1126970   2979900        7915200        1610800  \n1993-01-01             1135610   2834800        7820900        1563100  \n1994-01-01             1113180   2712800        7879800        1539300  \n1995-01-01             1099210   2593800        7997700        1472400  \n1996-01-01             1037050   2506400        7904700        1394200  \n1997-01-01             1023201   2460526        7743760        1354189  \n1998-01-01              974402   2329950        7373886        1240754  \n1999-01-01              911740   2100739        6955520        1152075  \n2000-01-01              911706   2050992        6971590        1160002  \n2001-01-01              909023   2116531        7092267        1228391  \n2002-01-01              891407   2151252        7057370        1246646  \n2003-01-01              859030   2154834        7026802        1261226  \n2004-01-01              847381   2144446        6937089        1237851  \n2005-01-01              862220   2155448        6783447        1235859  \n2006-01-01              860853   2183746        6607013        1192809  \n2007-01-01              855856   2176140        6568572        1095769  \n2008-01-01              842134   2228474        6588046         958629  \n2009-01-01              812514   2203313        6338095         795652  \n2010-01-01              781844   2168457        6204601         739565  \n2011-01-01              752423   2185140        6151095         716508  \n2012-01-01              762009   2109932        6168874         723186  \n2013-01-01              726575   1931835        6018632         700294  \n2014-01-01              741291   1729806        5858496         689527  ",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Population</th>\n      <th>Violent</th>\n      <th>Property</th>\n      <th>Murder</th>\n      <th>Forcible_Rape</th>\n      <th>Robbery</th>\n      <th>Aggravated_assault</th>\n      <th>Burglary</th>\n      <th>Larceny_Theft</th>\n      <th>Vehicle_Theft</th>\n    </tr>\n    <tr>\n      <th>Year</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>1960-01-01</th>\n      <td>179323175</td>\n      <td>288460</td>\n      <td>3095700</td>\n      <td>9110</td>\n      <td>17190</td>\n      <td>107840</td>\n      <td>154320</td>\n      <td>912100</td>\n      <td>1855400</td>\n      <td>328200</td>\n    </tr>\n    <tr>\n      <th>1961-01-01</th>\n      <td>182992000</td>\n      <td>289390</td>\n      <td>3198600</td>\n      <td>8740</td>\n      <td>17220</td>\n      <td>106670</td>\n      <td>156760</td>\n      <td>949600</td>\n      <td>1913000</td>\n      <td>336000</td>\n    </tr>\n    <tr>\n      <th>1962-01-01</th>\n      <td>185771000</td>\n      <td>301510</td>\n      <td>3450700</td>\n      <td>8530</td>\n      <td>17550</td>\n      <td>110860</td>\n      <td>164570</td>\n      <td>994300</td>\n      <td>2089600</td>\n      <td>366800</td>\n    </tr>\n    <tr>\n      <th>1963-01-01</th>\n      <td>188483000</td>\n      <td>316970</td>\n      <td>3792500</td>\n      <td>8640</td>\n      <td>17650</td>\n      <td>116470</td>\n      <td>174210</td>\n      <td>1086400</td>\n      <td>2297800</td>\n      <td>408300</td>\n    </tr>\n    <tr>\n      <th>1964-01-01</th>\n      <td>191141000</td>\n      <td>364220</td>\n      <td>4200400</td>\n      <td>9360</td>\n      <td>21420</td>\n      <td>130390</td>\n      <td>203050</td>\n      <td>1213200</td>\n      <td>2514400</td>\n      <td>472800</td>\n    </tr>\n    <tr>\n      <th>1965-01-01</th>\n      <td>193526000</td>\n      <td>387390</td>\n      <td>4352000</td>\n      <td>9960</td>\n      <td>23410</td>\n      <td>138690</td>\n      <td>215330</td>\n      <td>1282500</td>\n      <td>2572600</td>\n      <td>496900</td>\n    </tr>\n    <tr>\n      <th>1966-01-01</th>\n      <td>195576000</td>\n      <td>430180</td>\n      <td>4793300</td>\n      <td>11040</td>\n      <td>25820</td>\n      <td>157990</td>\n      <td>235330</td>\n      <td>1410100</td>\n      <td>2822000</td>\n      <td>561200</td>\n    </tr>\n    <tr>\n      <th>1967-01-01</th>\n      <td>197457000</td>\n      <td>499930</td>\n      <td>5403500</td>\n      <td>12240</td>\n      <td>27620</td>\n      <td>202910</td>\n      <td>257160</td>\n      <td>1632100</td>\n      <td>3111600</td>\n      <td>659800</td>\n    </tr>\n    <tr>\n      <th>1968-01-01</th>\n      <td>199399000</td>\n      <td>595010</td>\n      <td>6125200</td>\n      <td>13800</td>\n      <td>31670</td>\n      <td>262840</td>\n      <td>286700</td>\n      <td>1858900</td>\n      <td>3482700</td>\n      <td>783600</td>\n    </tr>\n    <tr>\n      <th>1969-01-01</th>\n      <td>201385000</td>\n      <td>661870</td>\n      <td>6749000</td>\n      <td>14760</td>\n      <td>37170</td>\n      <td>298850</td>\n      <td>311090</td>\n      <td>1981900</td>\n      <td>3888600</td>\n      <td>878500</td>\n    </tr>\n    <tr>\n      <th>1970-01-01</th>\n      <td>203235298</td>\n      <td>738820</td>\n      <td>7359200</td>\n      <td>16000</td>\n      <td>37990</td>\n      <td>349860</td>\n      <td>334970</td>\n      <td>2205000</td>\n      <td>4225800</td>\n      <td>928400</td>\n    </tr>\n    <tr>\n      <th>1971-01-01</th>\n      <td>206212000</td>\n      <td>816500</td>\n      <td>7771700</td>\n      <td>17780</td>\n      <td>42260</td>\n      <td>387700</td>\n      <td>368760</td>\n      <td>2399300</td>\n      <td>4424200</td>\n      <td>948200</td>\n    </tr>\n    <tr>\n      <th>1972-01-01</th>\n      <td>208230000</td>\n      <td>834900</td>\n      <td>7413900</td>\n      <td>18670</td>\n      <td>46850</td>\n      <td>376290</td>\n      <td>393090</td>\n      <td>2375500</td>\n      <td>4151200</td>\n      <td>887200</td>\n    </tr>\n    <tr>\n      <th>1973-01-01</th>\n      <td>209851000</td>\n      <td>875910</td>\n      <td>7842200</td>\n      <td>19640</td>\n      <td>51400</td>\n      <td>384220</td>\n      <td>420650</td>\n      <td>2565500</td>\n      <td>4347900</td>\n      <td>928800</td>\n    </tr>\n    <tr>\n      <th>1974-01-01</th>\n      <td>211392000</td>\n      <td>974720</td>\n      <td>9278700</td>\n      <td>20710</td>\n      <td>55400</td>\n      <td>442400</td>\n      <td>456210</td>\n      <td>3039200</td>\n      <td>5262500</td>\n      <td>977100</td>\n    </tr>\n    <tr>\n      <th>1975-01-01</th>\n      <td>213124000</td>\n      <td>1039710</td>\n      <td>10252700</td>\n      <td>20510</td>\n      <td>56090</td>\n      <td>470500</td>\n      <td>492620</td>\n      <td>3265300</td>\n      <td>5977700</td>\n      <td>1009600</td>\n    </tr>\n    <tr>\n      <th>1976-01-01</th>\n      <td>214659000</td>\n      <td>1004210</td>\n      <td>10345500</td>\n      <td>18780</td>\n      <td>57080</td>\n      <td>427810</td>\n      <td>500530</td>\n      <td>3108700</td>\n      <td>6270800</td>\n      <td>966000</td>\n    </tr>\n    <tr>\n      <th>1977-01-01</th>\n      <td>216332000</td>\n      <td>1029580</td>\n      <td>9955000</td>\n      <td>19120</td>\n      <td>63500</td>\n      <td>412610</td>\n      <td>534350</td>\n      <td>3071500</td>\n      <td>5905700</td>\n      <td>977700</td>\n    </tr>\n    <tr>\n      <th>1978-01-01</th>\n      <td>218059000</td>\n      <td>1085550</td>\n      <td>10123400</td>\n      <td>19560</td>\n      <td>67610</td>\n      <td>426930</td>\n      <td>571460</td>\n      <td>3128300</td>\n      <td>5991000</td>\n      <td>1004100</td>\n    </tr>\n    <tr>\n      <th>1979-01-01</th>\n      <td>220099000</td>\n      <td>1208030</td>\n      <td>11041500</td>\n      <td>21460</td>\n      <td>76390</td>\n      <td>480700</td>\n      <td>629480</td>\n      <td>3327700</td>\n      <td>6601000</td>\n      <td>1112800</td>\n    </tr>\n    <tr>\n      <th>1980-01-01</th>\n      <td>225349264</td>\n      <td>1344520</td>\n      <td>12063700</td>\n      <td>23040</td>\n      <td>82990</td>\n      <td>565840</td>\n      <td>672650</td>\n      <td>3795200</td>\n      <td>7136900</td>\n      <td>1131700</td>\n    </tr>\n    <tr>\n      <th>1981-01-01</th>\n      <td>229146000</td>\n      <td>1361820</td>\n      <td>12061900</td>\n      <td>22520</td>\n      <td>82500</td>\n      <td>592910</td>\n      <td>663900</td>\n      <td>3779700</td>\n      <td>7194400</td>\n      <td>1087800</td>\n    </tr>\n    <tr>\n      <th>1982-01-01</th>\n      <td>231534000</td>\n      <td>1322390</td>\n      <td>11652000</td>\n      <td>21010</td>\n      <td>78770</td>\n      <td>553130</td>\n      <td>669480</td>\n      <td>3447100</td>\n      <td>7142500</td>\n      <td>1062400</td>\n    </tr>\n    <tr>\n      <th>1983-01-01</th>\n      <td>233981000</td>\n      <td>1258090</td>\n      <td>10850500</td>\n      <td>19310</td>\n      <td>78920</td>\n      <td>506570</td>\n      <td>653290</td>\n      <td>3129900</td>\n      <td>6712800</td>\n      <td>1007900</td>\n    </tr>\n    <tr>\n      <th>1984-01-01</th>\n      <td>236158000</td>\n      <td>1273280</td>\n      <td>10608500</td>\n      <td>18690</td>\n      <td>84230</td>\n      <td>485010</td>\n      <td>685350</td>\n      <td>2984400</td>\n      <td>6591900</td>\n      <td>1032200</td>\n    </tr>\n    <tr>\n      <th>1985-01-01</th>\n      <td>238740000</td>\n      <td>1328800</td>\n      <td>11102600</td>\n      <td>18980</td>\n      <td>88670</td>\n      <td>497870</td>\n      <td>723250</td>\n      <td>3073300</td>\n      <td>6926400</td>\n      <td>1102900</td>\n    </tr>\n    <tr>\n      <th>1986-01-01</th>\n      <td>240132887</td>\n      <td>1489169</td>\n      <td>11722700</td>\n      <td>20613</td>\n      <td>91459</td>\n      <td>542775</td>\n      <td>834322</td>\n      <td>3241410</td>\n      <td>7257153</td>\n      <td>1224137</td>\n    </tr>\n    <tr>\n      <th>1987-01-01</th>\n      <td>242282918</td>\n      <td>1483999</td>\n      <td>12024700</td>\n      <td>20096</td>\n      <td>91110</td>\n      <td>517704</td>\n      <td>855088</td>\n      <td>3236184</td>\n      <td>7499900</td>\n      <td>1288674</td>\n    </tr>\n    <tr>\n      <th>1988-01-01</th>\n      <td>245807000</td>\n      <td>1566220</td>\n      <td>12356900</td>\n      <td>20680</td>\n      <td>92490</td>\n      <td>542970</td>\n      <td>910090</td>\n      <td>3218100</td>\n      <td>7705900</td>\n      <td>1432900</td>\n    </tr>\n    <tr>\n      <th>1989-01-01</th>\n      <td>248239000</td>\n      <td>1646040</td>\n      <td>12605400</td>\n      <td>21500</td>\n      <td>94500</td>\n      <td>578330</td>\n      <td>951710</td>\n      <td>3168200</td>\n      <td>7872400</td>\n      <td>1564800</td>\n    </tr>\n    <tr>\n      <th>1990-01-01</th>\n      <td>248709873</td>\n      <td>1820130</td>\n      <td>12655500</td>\n      <td>23440</td>\n      <td>102560</td>\n      <td>639270</td>\n      <td>1054860</td>\n      <td>3073900</td>\n      <td>7945700</td>\n      <td>1635900</td>\n    </tr>\n    <tr>\n      <th>1991-01-01</th>\n      <td>252177000</td>\n      <td>1911770</td>\n      <td>12961100</td>\n      <td>24700</td>\n      <td>106590</td>\n      <td>687730</td>\n      <td>1092740</td>\n      <td>3157200</td>\n      <td>8142200</td>\n      <td>1661700</td>\n    </tr>\n    <tr>\n      <th>1992-01-01</th>\n      <td>255082000</td>\n      <td>1932270</td>\n      <td>12505900</td>\n      <td>23760</td>\n      <td>109060</td>\n      <td>672480</td>\n      <td>1126970</td>\n      <td>2979900</td>\n      <td>7915200</td>\n      <td>1610800</td>\n    </tr>\n    <tr>\n      <th>1993-01-01</th>\n      <td>257908000</td>\n      <td>1926020</td>\n      <td>12218800</td>\n      <td>24530</td>\n      <td>106010</td>\n      <td>659870</td>\n      <td>1135610</td>\n      <td>2834800</td>\n      <td>7820900</td>\n      <td>1563100</td>\n    </tr>\n    <tr>\n      <th>1994-01-01</th>\n      <td>260341000</td>\n      <td>1857670</td>\n      <td>12131900</td>\n      <td>23330</td>\n      <td>102220</td>\n      <td>618950</td>\n      <td>1113180</td>\n      <td>2712800</td>\n      <td>7879800</td>\n      <td>1539300</td>\n    </tr>\n    <tr>\n      <th>1995-01-01</th>\n      <td>262755000</td>\n      <td>1798790</td>\n      <td>12063900</td>\n      <td>21610</td>\n      <td>97470</td>\n      <td>580510</td>\n      <td>1099210</td>\n      <td>2593800</td>\n      <td>7997700</td>\n      <td>1472400</td>\n    </tr>\n    <tr>\n      <th>1996-01-01</th>\n      <td>265228572</td>\n      <td>1688540</td>\n      <td>11805300</td>\n      <td>19650</td>\n      <td>96250</td>\n      <td>535590</td>\n      <td>1037050</td>\n      <td>2506400</td>\n      <td>7904700</td>\n      <td>1394200</td>\n    </tr>\n    <tr>\n      <th>1997-01-01</th>\n      <td>267637000</td>\n      <td>1634770</td>\n      <td>11558175</td>\n      <td>18208</td>\n      <td>96153</td>\n      <td>498534</td>\n      <td>1023201</td>\n      <td>2460526</td>\n      <td>7743760</td>\n      <td>1354189</td>\n    </tr>\n    <tr>\n      <th>1998-01-01</th>\n      <td>270296000</td>\n      <td>1531044</td>\n      <td>10944590</td>\n      <td>16914</td>\n      <td>93103</td>\n      <td>446625</td>\n      <td>974402</td>\n      <td>2329950</td>\n      <td>7373886</td>\n      <td>1240754</td>\n    </tr>\n    <tr>\n      <th>1999-01-01</th>\n      <td>272690813</td>\n      <td>1426044</td>\n      <td>10208334</td>\n      <td>15522</td>\n      <td>89411</td>\n      <td>409371</td>\n      <td>911740</td>\n      <td>2100739</td>\n      <td>6955520</td>\n      <td>1152075</td>\n    </tr>\n    <tr>\n      <th>2000-01-01</th>\n      <td>281421906</td>\n      <td>1425486</td>\n      <td>10182586</td>\n      <td>15586</td>\n      <td>90178</td>\n      <td>408016</td>\n      <td>911706</td>\n      <td>2050992</td>\n      <td>6971590</td>\n      <td>1160002</td>\n    </tr>\n    <tr>\n      <th>2001-01-01</th>\n      <td>285317559</td>\n      <td>1439480</td>\n      <td>10437480</td>\n      <td>16037</td>\n      <td>90863</td>\n      <td>423557</td>\n      <td>909023</td>\n      <td>2116531</td>\n      <td>7092267</td>\n      <td>1228391</td>\n    </tr>\n    <tr>\n      <th>2002-01-01</th>\n      <td>287973924</td>\n      <td>1423677</td>\n      <td>10455277</td>\n      <td>16229</td>\n      <td>95235</td>\n      <td>420806</td>\n      <td>891407</td>\n      <td>2151252</td>\n      <td>7057370</td>\n      <td>1246646</td>\n    </tr>\n    <tr>\n      <th>2003-01-01</th>\n      <td>290690788</td>\n      <td>1383676</td>\n      <td>10442862</td>\n      <td>16528</td>\n      <td>93883</td>\n      <td>414235</td>\n      <td>859030</td>\n      <td>2154834</td>\n      <td>7026802</td>\n      <td>1261226</td>\n    </tr>\n    <tr>\n      <th>2004-01-01</th>\n      <td>293656842</td>\n      <td>1360088</td>\n      <td>10319386</td>\n      <td>16148</td>\n      <td>95089</td>\n      <td>401470</td>\n      <td>847381</td>\n      <td>2144446</td>\n      <td>6937089</td>\n      <td>1237851</td>\n    </tr>\n    <tr>\n      <th>2005-01-01</th>\n      <td>296507061</td>\n      <td>1390745</td>\n      <td>10174754</td>\n      <td>16740</td>\n      <td>94347</td>\n      <td>417438</td>\n      <td>862220</td>\n      <td>2155448</td>\n      <td>6783447</td>\n      <td>1235859</td>\n    </tr>\n    <tr>\n      <th>2006-01-01</th>\n      <td>299398484</td>\n      <td>1418043</td>\n      <td>9983568</td>\n      <td>17030</td>\n      <td>92757</td>\n      <td>447403</td>\n      <td>860853</td>\n      <td>2183746</td>\n      <td>6607013</td>\n      <td>1192809</td>\n    </tr>\n    <tr>\n      <th>2007-01-01</th>\n      <td>301621157</td>\n      <td>1408337</td>\n      <td>9843481</td>\n      <td>16929</td>\n      <td>90427</td>\n      <td>445125</td>\n      <td>855856</td>\n      <td>2176140</td>\n      <td>6568572</td>\n      <td>1095769</td>\n    </tr>\n    <tr>\n      <th>2008-01-01</th>\n      <td>304374846</td>\n      <td>1392628</td>\n      <td>9767915</td>\n      <td>16442</td>\n      <td>90479</td>\n      <td>443574</td>\n      <td>842134</td>\n      <td>2228474</td>\n      <td>6588046</td>\n      <td>958629</td>\n    </tr>\n    <tr>\n      <th>2009-01-01</th>\n      <td>307006550</td>\n      <td>1325896</td>\n      <td>9337060</td>\n      <td>15399</td>\n      <td>89241</td>\n      <td>408742</td>\n      <td>812514</td>\n      <td>2203313</td>\n      <td>6338095</td>\n      <td>795652</td>\n    </tr>\n    <tr>\n      <th>2010-01-01</th>\n      <td>309330219</td>\n      <td>1251248</td>\n      <td>9112625</td>\n      <td>14772</td>\n      <td>85593</td>\n      <td>369089</td>\n      <td>781844</td>\n      <td>2168457</td>\n      <td>6204601</td>\n      <td>739565</td>\n    </tr>\n    <tr>\n      <th>2011-01-01</th>\n      <td>311587816</td>\n      <td>1206031</td>\n      <td>9052743</td>\n      <td>14661</td>\n      <td>84175</td>\n      <td>354772</td>\n      <td>752423</td>\n      <td>2185140</td>\n      <td>6151095</td>\n      <td>716508</td>\n    </tr>\n    <tr>\n      <th>2012-01-01</th>\n      <td>313873685</td>\n      <td>1217067</td>\n      <td>9001992</td>\n      <td>14866</td>\n      <td>85141</td>\n      <td>355051</td>\n      <td>762009</td>\n      <td>2109932</td>\n      <td>6168874</td>\n      <td>723186</td>\n    </tr>\n    <tr>\n      <th>2013-01-01</th>\n      <td>316497531</td>\n      <td>1199684</td>\n      <td>8650761</td>\n      <td>14319</td>\n      <td>82109</td>\n      <td>345095</td>\n      <td>726575</td>\n      <td>1931835</td>\n      <td>6018632</td>\n      <td>700294</td>\n    </tr>\n    <tr>\n      <th>2014-01-01</th>\n      <td>318857056</td>\n      <td>1197987</td>\n      <td>8277829</td>\n      <td>14249</td>\n      <td>84041</td>\n      <td>325802</td>\n      <td>741291</td>\n      <td>1729806</td>\n      <td>5858496</td>\n      <td>689527</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 134,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "crime.drop(columns=['Total'],axis=1)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 8. Group the year by decades and sum the values\n",
    "\n",
    "#### Pay attention to the Population column number, summing this column is a mistake"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "metadata": {
    "collapsed": false,
    "scrolled": true,
    "ExecuteTime": {
     "end_time": "2024-01-13T09:26:56.631657Z",
     "start_time": "2024-01-13T09:26:56.564501Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "            Population      Total   Violent   Property  Murder  Forcible_Rape  \\\nYear                                                                            \n1960-01-01   201385000   49295900   4134930   45160900  106180         236720   \n1970-01-01   220099000  100991600   9607930   91383800  192230         554570   \n1980-01-01   248239000  131123369  14074328  117048900  206439         865639   \n1990-01-01   272690813  136582146  17527048  119053499  211664         998827   \n2000-01-01   307006550  115012044  13968056  100944369  163068         922499   \n2010-01-01   318857056   50167967   6072017   44095950   72867         421059   \n\n            Robbery  Aggravated_assault  Burglary  Larceny_Theft  \\\nYear                                                               \n1960-01-01  1633510             2158520  13321100       26547700   \n1970-01-01  4159020             4702120  28486000       53157800   \n1980-01-01  5383109             7619130  33073494       72040253   \n1990-01-01  5748930            10568963  26750015       77679366   \n2000-01-01  4230366             8652124  21565176       67970291   \n2010-01-01  1749809             3764142  10125170       30401698   \n\n            Vehicle_Theft  \nYear                       \n1960-01-01        5292100  \n1970-01-01        9739900  \n1980-01-01       11935411  \n1990-01-01       14624418  \n2000-01-01       11412834  \n2010-01-01        3569080  ",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Population</th>\n      <th>Total</th>\n      <th>Violent</th>\n      <th>Property</th>\n      <th>Murder</th>\n      <th>Forcible_Rape</th>\n      <th>Robbery</th>\n      <th>Aggravated_assault</th>\n      <th>Burglary</th>\n      <th>Larceny_Theft</th>\n      <th>Vehicle_Theft</th>\n    </tr>\n    <tr>\n      <th>Year</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>1960-01-01</th>\n      <td>201385000</td>\n      <td>49295900</td>\n      <td>4134930</td>\n      <td>45160900</td>\n      <td>106180</td>\n      <td>236720</td>\n      <td>1633510</td>\n      <td>2158520</td>\n      <td>13321100</td>\n      <td>26547700</td>\n      <td>5292100</td>\n    </tr>\n    <tr>\n      <th>1970-01-01</th>\n      <td>220099000</td>\n      <td>100991600</td>\n      <td>9607930</td>\n      <td>91383800</td>\n      <td>192230</td>\n      <td>554570</td>\n      <td>4159020</td>\n      <td>4702120</td>\n      <td>28486000</td>\n      <td>53157800</td>\n      <td>9739900</td>\n    </tr>\n    <tr>\n      <th>1980-01-01</th>\n      <td>248239000</td>\n      <td>131123369</td>\n      <td>14074328</td>\n      <td>117048900</td>\n      <td>206439</td>\n      <td>865639</td>\n      <td>5383109</td>\n      <td>7619130</td>\n      <td>33073494</td>\n      <td>72040253</td>\n      <td>11935411</td>\n    </tr>\n    <tr>\n      <th>1990-01-01</th>\n      <td>272690813</td>\n      <td>136582146</td>\n      <td>17527048</td>\n      <td>119053499</td>\n      <td>211664</td>\n      <td>998827</td>\n      <td>5748930</td>\n      <td>10568963</td>\n      <td>26750015</td>\n      <td>77679366</td>\n      <td>14624418</td>\n    </tr>\n    <tr>\n      <th>2000-01-01</th>\n      <td>307006550</td>\n      <td>115012044</td>\n      <td>13968056</td>\n      <td>100944369</td>\n      <td>163068</td>\n      <td>922499</td>\n      <td>4230366</td>\n      <td>8652124</td>\n      <td>21565176</td>\n      <td>67970291</td>\n      <td>11412834</td>\n    </tr>\n    <tr>\n      <th>2010-01-01</th>\n      <td>318857056</td>\n      <td>50167967</td>\n      <td>6072017</td>\n      <td>44095950</td>\n      <td>72867</td>\n      <td>421059</td>\n      <td>1749809</td>\n      <td>3764142</td>\n      <td>10125170</td>\n      <td>30401698</td>\n      <td>3569080</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 135,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Uses resample to sum each decade\n",
    "crimes = crime.resample('10AS').sum()\n",
    "\n",
    "# Uses resample to get the max value only for the \"Population\" column\n",
    "population = crime['Population'].resample('10AS').max()\n",
    "\n",
    "# Updating the \"Population\" column\n",
    "crimes['Population'] = population\n",
    "\n",
    "crimes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 9. What is the most dangerous decade to live in the US?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 142,
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T09:30:33.302340Z",
     "start_time": "2024-01-13T09:30:33.294198Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": "      Population      Total   Violent   Property  Murder  Forcible_Rape  \\\nYear                                                                      \n1960   201385000   49295900   4134930   45160900  106180         236720   \n1970   220099000  100991600   9607930   91383800  192230         554570   \n1980   248239000  131123369  14074328  117048900  206439         865639   \n1990   272690813  136582146  17527048  119053499  211664         998827   \n2000   307006550  115012044  13968056  100944369  163068         922499   \n2010   318857056   50167967   6072017   44095950   72867         421059   \n\n      Robbery  Aggravated_assault  Burglary  Larceny_Theft  Vehicle_Theft  \nYear                                                                       \n1960  1633510             2158520  13321100       26547700        5292100  \n1970  4159020             4702120  28486000       53157800        9739900  \n1980  5383109             7619130  33073494       72040253       11935411  \n1990  5748930            10568963  26750015       77679366       14624418  \n2000  4230366             8652124  21565176       67970291       11412834  \n2010  1749809             3764142  10125170       30401698        3569080  ",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Population</th>\n      <th>Total</th>\n      <th>Violent</th>\n      <th>Property</th>\n      <th>Murder</th>\n      <th>Forcible_Rape</th>\n      <th>Robbery</th>\n      <th>Aggravated_assault</th>\n      <th>Burglary</th>\n      <th>Larceny_Theft</th>\n      <th>Vehicle_Theft</th>\n    </tr>\n    <tr>\n      <th>Year</th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>1960</th>\n      <td>201385000</td>\n      <td>49295900</td>\n      <td>4134930</td>\n      <td>45160900</td>\n      <td>106180</td>\n      <td>236720</td>\n      <td>1633510</td>\n      <td>2158520</td>\n      <td>13321100</td>\n      <td>26547700</td>\n      <td>5292100</td>\n    </tr>\n    <tr>\n      <th>1970</th>\n      <td>220099000</td>\n      <td>100991600</td>\n      <td>9607930</td>\n      <td>91383800</td>\n      <td>192230</td>\n      <td>554570</td>\n      <td>4159020</td>\n      <td>4702120</td>\n      <td>28486000</td>\n      <td>53157800</td>\n      <td>9739900</td>\n    </tr>\n    <tr>\n      <th>1980</th>\n      <td>248239000</td>\n      <td>131123369</td>\n      <td>14074328</td>\n      <td>117048900</td>\n      <td>206439</td>\n      <td>865639</td>\n      <td>5383109</td>\n      <td>7619130</td>\n      <td>33073494</td>\n      <td>72040253</td>\n      <td>11935411</td>\n    </tr>\n    <tr>\n      <th>1990</th>\n      <td>272690813</td>\n      <td>136582146</td>\n      <td>17527048</td>\n      <td>119053499</td>\n      <td>211664</td>\n      <td>998827</td>\n      <td>5748930</td>\n      <td>10568963</td>\n      <td>26750015</td>\n      <td>77679366</td>\n      <td>14624418</td>\n    </tr>\n    <tr>\n      <th>2000</th>\n      <td>307006550</td>\n      <td>115012044</td>\n      <td>13968056</td>\n      <td>100944369</td>\n      <td>163068</td>\n      <td>922499</td>\n      <td>4230366</td>\n      <td>8652124</td>\n      <td>21565176</td>\n      <td>67970291</td>\n      <td>11412834</td>\n    </tr>\n    <tr>\n      <th>2010</th>\n      <td>318857056</td>\n      <td>50167967</td>\n      <td>6072017</td>\n      <td>44095950</td>\n      <td>72867</td>\n      <td>421059</td>\n      <td>1749809</td>\n      <td>3764142</td>\n      <td>10125170</td>\n      <td>30401698</td>\n      <td>3569080</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 142,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "crimes.index = pd.to_datetime(crimes.index, format='%Y')\n",
    "crimes.index = crimes.index.strftime('%Y')\n",
    "crimes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 140,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-01-13T09:29:49.781472Z",
     "start_time": "2024-01-13T09:29:49.750290Z"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   }
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "name": "python3",
   "language": "python",
   "display_name": "Python 3 (ipykernel)"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
